TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: John Gardeniers
date: 1998-10-09 15:51:20
subject: Tutorial questions?

Hi Bill,

Thanks Bill. I have been ignoring the rest of the replies in this thread but
yours deserves, and requires, an answer.

 -=> 01 Oct 98 07:56, Bill Birrell wrote to Tom Torfs <=-

 BB> "97  The implementation may place a const object that is not volatile
 BB> in a read-only region of storage. Moreover, the implementation need
 BB> not allocate storage for such an object if its address is never used."

Interesting wording. As far as I'm concerned ALL constants are non-volatile.
They can be nothing else. If it's volatile it can hardly be thought of as a
constant, can it? Beside, I don't read standards. I simply examined run time
code. ;-)

Several things appear to have been overlooked by quite a few participants of
this echo. With his knowledge of assembler, Tom in particular *should* have
have been considerably less forceful in his assertions. Indeed, he should have 
a much better understanding of what actually happens when a compiler goes into 
action.

By it's very nature a const is best hard coded within the machine code
instructions which comprise the actual run time program. This means of course
that no storage space is required to hold the "variable". To use variable
storage space on something which is not a variable in any real sense is absurd 
and wasteful of resources. May as well shove a few thousand copies of it on the
stack. My sympathies go to anyone unfortunate enough to have a compiler which
doesn't understand these things.

Many people seem to think that the ability to create a pointer to something is 
"proof" that memory is set aside for it. This is of course nonsense as a
pointer merely points to a memory address, real or otherwise. There is no rule 
to say that such an address must be within an area reserved for variable
storage. Indeed, there is nothing to prevent us creating pointers to
non-existing memory addresses. I'm sure we've all experienced cases where this 
has been adequately proven.

 BB>     So John is not wrong there. An identifier type-qualified as const
 BB> *in C* does NOT require storage space unless its address is used.

And not even then. All that is required, as a minimum, is a single instance of 
the value of the "variable" somewhere within the program's address space.

And with that I'll say goodbye. Echo disconnected.......

... Stupid is Forever, Ignorance can be Fixed!
--- GoldED/W32 3.00.Beta3 UNREG
* Origin: The Cubby House (3:634/391)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/383 384 391 397 635/506 728
SEEN-BY: 635/810 639/252 670/218
@PATH: 634/391 397 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

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™.