Subject: stdio glitch
To: None <tech-userlevel@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-userlevel
Date: 07/15/2000 12:25:23
Is this allowed?

	% cat foo.c
	#include <stdio.h>
	int foo(void *fvp)
	{ return(ferror(fvp));
	}
	% cc -c foo.c
	foo.c: In function `foo':
	"foo.c", line 3: warning: dereferencing `void *' pointer
	"foo.c", line 3: request for member `_flags' in something not a structure or union
	% 

ferror isn't *documented* as being non-function-like[%], and if it were
a real function that would work fine (and indeed s/ferror/(ferror)/
makes the complaint go away).

[%] At least not unless you notice, follow, and carefully read the
stdio(3) SEE ALSO.

Yet just adding a cast to ferror()'s definition isn't right either;
that allows too much instead of too little latitude.

Thoughts?  Should ferror be an inline function, maybe?  Or am I being
unreasonable in expecting stdio "functions" to act like functions?

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B