www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/18/23:19:37

Date: Fri, 18 Aug 95 20:35 MDT
From: mat AT ardi DOT com (Mat Hostetter)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: BUG IN V2??
Newsgroups: comp.os.msdos.djgpp
References: <DDBHEv DOT HFu AT jade DOT mv DOT net> <410ib1$qtl AT mark DOT ucdavis DOT edu> <iz03 DOT 808764412 AT jove>

>>>>> "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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019