Garrett D'Amore wrote:

>One potential concern.  I know of certain bits of code where strings
>like "$Id: some text$" are "edited" in place to form version numbers
>from $Id$ and similar strings.
>
>The places I can think of actually occur in kernel code!
>
>  
>
Standard violating code?  I'm shocked!

How does this work with the gcc build, are compile options used so
string literals do not go in read only pages?

>I suspect that making this the default _might_ break a number of
>things.  It would be very, very helpful if we had compiler help to
>_detect_ incorrect attempts to write to constant strings.  I'm not sure
>-xstrconst will give us the warnings to catch them before they become
>bugs in the field.
>
>  
>
I'm not sure what lint level is used in the builds, but given

int main(void)
{
  char* xx = "fhfhfhf";
  xx[0] ='d';
  return 0;
}

lint -Nlevel=2 x.c

modification of constant data
    <unknown name>      :: x.c(4)

Lint spots the error.

Ian

_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to