[comp.sys.mac.programmer] 'const'

awd@dbase.UUCP (Alastair Dallas) (08/17/89)

As a regular reader of comp.lang.c, I had no idea my dismissal of 'const'
would stir up such controversy in a Macintosh newsgroup.  All I meant to
say was that C programs would not be limited by the lack of 'const' or
'volatile'--but they would obviously not be able to take advantage of 
these features, either.  Then I got flip and recommended Pascal instead
without an explicit smiley :-).  My apologies.

THINK C knows what's good for you in terms of memory organization on the 
Macintosh, or at least it thinks it does.  It puts static data here, strings
there, code somewhere else.  You can jump on me for saying that TC doesn't
allow you to customize these things very much, but the term 'very much' is
clearly relative and I spend my days working with Microsoft C v5.1 for 
the IBM PC and that environment can be modified almost infinitely.

So, in the context of THINK C, 'const' would not be very valuable--just
as register variables were not very valuable on the first microcomputer
C compilers because even if the compiler supported the concept, the
number of available registers was still quite small.  You can sprinkle
'const' and 'register' where appropriate in your code, however, and hope
for some benefit down the road.  This version of THINK C forces you to
#define const to null if you want to take this approach, that's all.

I have to admit I was really impressed at the learned feedback on 'const'--
I thought this newsgroup was just full of people who _really_ understood
handles and resources.  There doesn't seem to be much overlap--Chris Torek
and Doug Gwyn never reply to Tim Maroney or Juri Munkki that I've seen. :-)
I love UseNet--it is a constant reminder that there are smart people
scattered all over the world.

/alastair/