[Gllug] SIGSEGV error

Nix nix at esperi.org.uk
Fri Aug 31 12:41:15 UTC 2007


On 31 Aug 2007, t. clarke told this:
> My recollections of this particular problem I encountered some years back are a
> little hazy, other than the fact that a C program compiled and working fine on
> a SCO Openserver machine (using the SDCO compiler) fell over when compiled on
> a GCC compiler without the use of -fwritable-strings.
>
> I believe in the main() section there was a string variable declared either as
>
> char yyx[]="thequickbrownfoxsatonthelazydog"
> or
> char *xyz="thequickbrownfoxsatonthelazydog"
>
> I neither case was it declared to be static;  maybe that was the mistake ?

Nope. char foo[]="a constant" declares a modifiable string: char *foo="a constant"
declares a pointer to a (nonmodifiable) string constant.

> If I can locate the bit of 'offending' code I will revisit it and see where
> the coding problem lies !

[subsequently emailed, yep, that was it]
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list