TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: Tom Torfs
date: 1998-10-03 13:51:58
subject: Tutorial questions?

Bill Birrell wrote in a message to Tom Torfs:

 BB>     [storage of const objects]

 > Probably because it isn't true :-)

 BB>     But it is true, Tom, under certain circumstances which John may
 BB> well have taken for granted. See 6.5.3 note 97 of the standard.

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

Yes, that's a footnote, which may explain why I overlooked it. So I learned
something new today :-)

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

Make that "_may_ not require storage space" and I'll agree.
Assuming this will always happen is definitely not a good idea. So if you
want to be sure that your constants don't take up any space, you should
still use #define.

greetings,
Tom
tomtorfs{at}village.uunet.be

--- timEd/2 1.10+
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 634/397 635/506 728 810 639/252
SEEN-BY: 670/218
@PATH: 292/516 106/1 396/1 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™.