Article View: comp.std.c++
Article #903Re: Encouraging readonly memory (was ~const)
From: Jim ADCOCK
Date: Mon, 04 Mar 1991 22:57
Date: Mon, 04 Mar 1991 22:57
29 lines
1903 bytes
1903 bytes
In article <4200@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes:
|Hummm... I'll bet you would like to see the data object called `array' in
|the following example be able to go into ROM. Interestingly, I think
|that the semantics currently defined for the initialization of local
|static objects might effectively prohibit such treatment.
|
| void foobar ()
| {
| static const char array[] = "Hello world.\n";
|
| // ...
| }
|
|This is probably not the best example I could have cooked up, but if you
|read the bottom half of page 92 in the ARM, you may see the problem that
|I'm getting at.
I'm not sure I do. I don't see any problems with you example.
Perhaps you can clarify? You seem to be concerned about how ROM
initialization can occur the first time through foobar if the
contents of array[] are held in ROM? Answer: none of the programmer's
business how the implementation "causes" this to happen, as long
as there is no way for the programmer to legally tell the difference.
In this case, there is no legal way for a programmer to detect the
exact moment that array[] is initialized, nor how, so an implementation
is free to do as it chooses, including taking the "sneaky" approach of
initializing array[] at compile time. This is quite different from
the example on page 92, which could indeed prove difficult to implement s
in ROM.
Technical Details
Message-ID:
<71044@microsoft.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!rice!uw-beaver!mit-eddie!wuarchive!uunet!microsoft!jimadReferences:
<1991Feb20.220900.7523@ithaca.uucp> <BRUCEC.91Feb21132333@phoebus.labs.tek.com> <4200@lupine.NCD.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!rice!uw-beaver!mit-eddie!wuarchive!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.std.c++ Subject: Re: Encouraging readonly memory (was ~const) Message-ID: <71044@microsoft.UUCP> Date: 4 Mar 91 22:57:15 GMT References: <1991Feb20.220900.7523@ithaca.uucp> <BRUCEC.91Feb21132333@phoebus.labs.tek.com> <4200@lupine.NCD.COM> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 29