home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!auspex-gw!guy
- From: guy@Auspex.COM (Guy Harris)
- Newsgroups: comp.unix.wizards
- Subject: Re: What is text, data & bss anyway?
- Message-ID: <15988@auspex-gw.auspex.com>
- Date: 18 Dec 92 02:29:01 GMT
- References: <1992Dec15.085938.5975@ericsson.se> <15907@auspex-gw.auspex.com> <MOSS.92Dec16110746@CRAFTY.cs.cmu.edu>
- Sender: news@auspex-gw.auspex.com
- Organization: Auspex Systems, Santa Clara
- Lines: 23
- Nntp-Posting-Host: auspex.auspex.com
-
- >Guy> What does GCC do with
- >
- >Guy> const char foo[] = "abcd";
- >
- >Guy> I.e., does it put it in the text or data segments? (Text segment, I
- >Guy> hope.)
- >
- >It puts it in the text segment by default. However, you can tell gcc to put
- >strings into the data segment (some programs actually expect to be able to
- >modify strings!) with the flag -fwritable-strings.
-
- I hope, however, that even with the flag "-fwritable-strings", it'd put
- "foo" in the text segment in my example.
-
- I.e., in my example, "abcd" isn't a string constant, it's a string
- initializer of a named array of "char".
-
- What does GCC do with
-
- const int foo[] = { 1, 137, 666 };
-
- Does it put it in the text or data segments? (Text segment, I hope.)
- The answer should be the same as the answer to my original question....
-