Path: 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> <4200@lupine.NCD.COM> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 29 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.