char *Foo VS. char Bar[]
Henry Spencer
henry at utzoo.uucp
Sat Apr 15 02:13:25 AEST 1989
In article <19636 at iuvax.cs.indiana.edu> bobmon at iuvax.cs.indiana.edu (RAMontante) writes:
> char *foo = " ";
> ...
> sprintf(foo,"xxxx");
>
>Using gcc on a VAX8650/Ultrix, the sprintf causes a bus error. The standard
>cc compiler produced code that "worked"...
Old C guaranteed that string constants were writeable storage. ANSI C says
that the compiler is entitled to make them read-only if it wants. Many
people have felt all along that writing into string constants was bad
practice.
--
Welcome to Mars! Your | Henry Spencer at U of Toronto Zoology
passport and visa, comrade? | uunet!attcan!utzoo!henry henry at zoo.toronto.edu
More information about the Comp.lang.c
mailing list