Mail Archives: djgpp/1995/08/18/23:19:37
>>>>> "Ertung" == Ertung Bora <iz03 AT jove DOT acs DOT unt DOT edu> writes:
elric AT wheel DOT ucdavis DOT edu (Jeffrey Taylor) writes:
>Is there any requirement for argv[1] to be dereferencable if argc == 1?
>If this were my program, I would guess I had gotten lucky on the OS and
>check before I call fopen.
Ertung> You look like pretty experienced programmer :). But As a
Ertung> matter of fact, this is a test program to test the
Ertung> different behaviours of standart C functions of different
Ertung> compilers.And I am pretty sure your comment will
Ertung> work. Thanks for advice anyway, it could help the
Ertung> beginners.
Unfortunately, I don't have a copy of the ANSI C standard. But
for what it's worth, _Harbison & Steele_, p. 359 says:
"The value of argv[argc] may be a null pointer, but it is not so in
all implementations."
Although I like _H & S_, I admit that it isn't authoritative by any
means. But it does suggest that programs should avoid assuming that
argv[argc] contains a legitimate value, and I'm inclined to believe
them.
-Mat
- Raw text -