Parameter mismatch legality question
Doug Gwyn
gwyn at smoke.brl.mil
Sun Nov 18 01:04:27 AEST 1990
In article <1990Nov16.212511.13166 at mozart.amd.com> tim at amd.com (Tim Olson) writes:
>I like that answer, but what about, say the UNIX "open" library call,
>which has the optional "mode" parameter used this way...
Originally, open() has exactly two arguments of fixed types, but USG
decided to make it variadic when they added O_CREAT. I doubt very
much that they worried at all about the non-portable aspects of such
an interface. They're also the ones who made the USG 4.0/5.0 IPC
functions return (pointer_type)-1 instead of null pointers as failure
indicators.
IEEE 1003.1 decided that open() had to be officially variadic, i.e.
extern int open( const char *path, int flags, ... );
Since this requires ANSI C support, you're best off if you let <fcntl.h>
declare open() for you.
More information about the Comp.lang.c
mailing list