TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: THE NATURAL PHILOSOPHER
from: JOHN RUMM
date: 2019-02-24 13:23:00
subject: Re: Rre: C is not a low l

On 24/02/2019 10:57, The Natural Philosopher wrote:
> On 24/02/2019 09:27, Gareth's was W7 now W10 Downstairs Computer wrote:
>> On 23/02/2019 12:26, Ozz Nixon wrote:
>>> On 2019-02-24 11:16:46 +0000, The Natural Philosopher -> Mr. Man-wai
>>> Chang
>>> said:
>>>>
>>>> And if more programs were written in it we would have programs of one
>>>> tenth the size runninmg ten times faster and a huge number of crap
>>>> programmers would be flipping burgers.
>>>
>>> KUDOS!!!!!!!!!!!!! I say that in StackOverflow and had my account
>>> banned. ;-)
>>
>> I missed the OP, but the thread title seems to me to be in error, because
>> AIUI the whole purpose of the cast facility is to be able to cast a
>> number as an integer pointer for accessing memory=mapped I/O.
>>
>> Can't get much lower than that!
>>
> That was the beauty of C. Years ago I was handed a ghastly hack of
> TurboPascal that needed to read a ram disk clock, and decide whetheer it
> was a FAT, File entry,  or a data block. Based on the first few bytes it
> might be almost anything.
>
> It proved quicker to write it in C where the data block could be read as
> an array of words, then depending on the value of some works, cast into
> an array of something else or a struccture...
>
> ...I spent an entire Sunday rewriting the whole program in C in a hotel
> room in Orleans...

More a demonstration of a lack of experience with turbo pascal than
anything else. It will go low down and dirty if you want and give you
raw memory access, untyped pointers etc.

> I love the fact that C will gently ask whether you really meant to treat
> an integer as a pointer to a string, and assume that oince you
> explicitly cast it so, you are clever enough to mean it.
>
> Only once has C let me down. In Assembler it is trivial to set up a call
> table - an arraye of address of subroutines that are called depending on
> an indexz value in te accumultaor. You take the base address of te
> aqrray into one regsiter, add the left shifted (on an 8 bit mnicro)
> accumulator to it and call te address ponted to by that register.

You mean like having an array of function pointers in C, and calling the
one at a certain index?

> And array of pointers to functions was beyond my ability to specify, and
> the crude 6809 compiler to understand anyway.

You can get lame compilers for pretty much any language IME!

> So I wrote it as an 'if then... else if..' chain...

No "switch" statement?


--
Cheers,

John.

/=================================================================\
|          Internode Ltd -  http://www.internode.co.uk            |
|-----------------------------------------------------------------|
|        John Rumm - john(at)internode(dot)co(dot)uk              |
\=================================================================/

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.