stdio - is it really standard?

Robert Vaughan vaughan at orion.UUCP
Sat Oct 11 09:25:02 AEST 1986

About a month ago I posted a response for someone, telling them how
to use scanf to read in double precision floating point (e.g.
scanf("%lf",&foo) where foo is declared as a double). This caused
a small round of debate about how various C implementations use
%lf, %Lf, etc. in their scanf's.

In the original K&R, it seems to me that their was no claim that
the functions described under stdio library would indeed be the
same across all machines. Let's not forget that stdio *is* just a
collection of C functions, written in C (that's part of what makes C
so nice - it has a small core syntax compared to Pascal and gargantua languages
such as PL/1...). In a bind, any good C programmer could write his own
stdio (yeech! what a horrible thought).

Now for a question: what is the status of stdio in the ANSI C definition?
Since programming C without stdio is like a day without sunshine (or
a day with lots of smog, here in LA :-)), I assume that ANSI has done some
work to firm up the various definitions of the functions in stdio. A short
answer would be best, since all of us can order up the ANSI draft to get
the details. Obviously, the answer also involves the data types allowed 
in ANSI C.

A related question involves the math libraries for things like
transcendental functions. Is sin() a now a valid ANSI C function/keyword?
Can I use the variable names sin and cos in my program if I don't
link the math library? 

Curiouser and curiouser...
Robert E. Vaughan
TRW Electronics Systems Group
{ !ucbvax!trwrb!orion!vaughan  is the only path I know... }

More information about the Comp.lang.c mailing list