Mail Archives: djgpp/1997/02/17/22:27:58
Ruiter de M wrote:
>
> John M. Aldrich (fighteer AT cs DOT com) wrote:
> : Ruiter de M wrote:
> : >
> : > : >char string[5]="abcde" and
> : > : >char *string="abcde" are equivalent.
>
> That's not what _I_ (mdruiter) wrote :)
Sorry. I thought the double quote would make it obvious, but the
previous poster clipped out the attribution line (or I did; I forget
now). :)
> Yes, you say _static_ data space. Which means it is not at all writable.
> For instance:
> ----- [example snipped]
> Not unpredictable at all. string1 is writable, string2 is not. Or am I getting
> something wrong?
No, but apparently this sort of thing is system-specific. When you do
that with DJGPP in DOS, it works fine (although it still is very
unsafe).
> Maybe you mean there is no difference in _pointer_, which I think is not
> true either.
[more snippage]
> test.c: In function `main':
> test.c:11: incompatible types in assignment
> -----
> No error for string2, error for string1.
> So. Different pointers to different memory. Or am I getting it wrong again?
No, here you are saying exactly what I said, later in my response. But
however you say it, it's still a bad idea to write into static data
space, and illegal to attempt to modify an array identifier. :)
--
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com |
| * Proud user of DJGPP! * | http://www.cs.com/fighteer |
| ObJoke: If Bill Gates were a robber, not only would he |
| shoot you, but he'd send you a bill for the bullets. |
---------------------------------------------------------------------
- Raw text -