tim@amdcad.UUCP (06/04/87)
In article <196@peaks.UUCP> bdw@peaks.UUCP (bruce welker) writes: > Where "some string" actually is is up to the compiler writer. The > two places I can think of off-hand are: > - in the code > - in some hidden global data area > Would some one who's written a C compiler comment on this? > > Bruce Welker > ...!hao!boulder!peaks!bdw This is what the "data 1" segment is for on PCC compilers. Normal initialized statics are stored in the "data" segment, while strings are placed in data 1 or data 2, depending upon the type of initialization. This allows the compiler to switch back-and-forth between segments to generate strings in the middle of generating another structure: ------------------------- char *strings[] = { "this", "is", "a test" }; ------------------------- LL0: .data .data ; use the default data segment .align 2 .globl _strings ; create a global label _strings: .data 2 ; switch to the "data 2" segment L12: ; generate a local (hidden) label .ascii "this\0" ; generate the string .data ; switch back to the default segment .long L12 ; generate a pointer to the string .data 2 L13: .ascii "is\0" .data .long L13 .data 2 L14: .ascii "a test\0" .data .long L14 .data -- Tim Olson Advanced Micro Devices ..ihnp4!amdcad!tim