Article View: comp.std.c
Article #3904Placement of string literals
From: Kurt Watzka
Date: Sun, 03 Sep 1995 11:53
Date: Sun, 03 Sep 1995 11:53
26 lines
1301 bytes
1301 bytes
Regarding the placement of string literals, the following question came up in de.comp.lang.c: Obviously, there are compilers that handle char *foo = "Hello world"; different form const char *bar = "Hello world"; as far as the placement of the string literal is concerned. String literals are arrays of "const char". This implies that they can be placed in read only memory. Does the definition of "foo" somehow prevent this placement? In other words, what is wrong with the statement: "String literals are arrays of const char, and hence may be placed in a read only region of storage, even if they are used to initialize a non const char *"? Kurt -- | Kurt Watzka Phone : +49-89-2180-6254 | watzka@stat.uni-muenchen.de | ua302aa@sunmail.lrz-muenchen.de
Technical Details
Message-ID:
<42c4uu$9e5@sparcserver.lrz-muenchen.de>Path:
arc1-ca.pugleaf.net!lrz-muenchen.de!sun2!ua302aaShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!lrz-muenchen.de!sun2!ua302aa From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka) Newsgroups: comp.std.c Subject: Placement of string literals Date: 3 Sep 1995 11:53:02 GMT Organization: Leibniz-Rechenzentrum, Muenchen (Germany) Distribution: world Message-ID: <42c4uu$9e5@sparcserver.lrz-muenchen.de> NNTP-Posting-Host: sun2.lrz-muenchen.de Summary: Does an initialization of a non const char * through a string literal e Keywords: string literals, const