Xref: utzoo unix-pc.general:2207 comp.sys.att:5490 gnu.gcc:201 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!att!icus!lenny From: lenny@icus.islp.ny.us (Lenny Tropiano) Newsgroups: unix-pc.general,comp.sys.att,gnu.gcc Subject: Re: gcc 1.33 compiled and working fine on UNIX pc/3B1 Message-ID: <598@icus.islp.ny.us> Date: 9 Feb 89 17:49:00 GMT References: <594@icus.islp.ny.us> <1092@banzai.UUCP> Reply-To: lenny@icus.islp.ny.us (Lenny Tropiano) Organization: ICUS Software Systems, Islip, New York Lines: 45 In article <1092@banzai.UUCP> roger@banzai.UUCP (Roger Florkowski) writes: |>In article <594@icus.islp.ny.us> lenny@icus.islp.ny.us (Me) write: |>>The compiler compiled flawlessly with the stock UNIX pc compiler .... |>A hint on using gcc: |> |>some programs 'like' it better if you use these flags: |> |>gcc -traditional -fwritable-strings |> ... |>-fwritable-strings affects what gcc does with character strings. |> /lib/ccom allowed writable strings. (read man-page) |> It would be better to fix the kludgy code that is taking constants, which the UNIX PC stock compiler puts in the "data" segment, and changing the contents of them. char *mystring = "hello, world\n"; Should go in the text segment (which the GNU gcc compiler does by default, unless specified with the -fwritable-strings option) which is sharable among processes on certain machines (I'm not sure how the UNIX pc handles it -- the old question of whether the "sticky-bit (t)" has any effect comes to mind again). It would not be good practice to modify "mystring" if it was initialized at compile time. The UNIX PC stock /lib/ccom (C compiler) would allow this, because it places the string in the data segment, without -fwritable-strings, any attempt to modify the mystring variable under the GNU gcc compiler would cause a "Memory fault" As the gcc documentation mentions, "constants should be constant!" Of course if you feel that you don't want to bother hacking up bad code to be correct, you can crutch on the -fwritable-strings compiler flag. -Lenny -- Lenny Tropiano ICUS Software Systems [w] +1 (516) 582-5525 lenny@icus.islp.ny.us Telex; 154232428 ICUS [h] +1 (516) 968-8576 {talcott,decuac,boulder,hombre,pacbell,sbcs}!icus!lenny attmail!icus!lenny ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752