Stefan Teleman writes:
> On Thursday 22 March 2007 15:42, [EMAIL PROTECTED] wrote:
> > >> getc(NULL) also blows up; what is your point?
> > >
> > >My point is that it should not SEGV on NULL pointer. It should
> > >return -1 and set EBADF.
> >
> > You are wrong; the standard disagrees with you.
> 
> 7.19.7.5.3:
> 
> The [getc] function returns the next characted from the input stream 
> pointed to by [stream]. If the stream is at end-of-file, the 
> end-of-file indicator for the stream is set and [getc] returns EOF. 
> If a read error occurs, the error indicator for the stream is set and 
> [getc] returns EOF.
> 
> Where does the standard disagree ? 

NULL isn't an input stream.

Also note the lack of an 'EFAULT' entry in the possible return values,
and that 'EBADF' talks about the validity of the file descriptor
underlying the stream.  As NULL isn't a stream, there is no such file
descriptor, nor can it be valid or invalid.

-- 
James Carlson, Solaris Networking              <[EMAIL PROTECTED]>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to