[comp.unix.wizards] "lseek" in ANSI C

guy%gorodish@Sun.COM (Guy Harris) (09/09/87)

>    Sounds to me as if some (most?) of the people on that group are making
> some pretty heavy assumptions,

Yes.  For one thing, they are assuming that C may be used on systems that may
put up CONSIDERABLE resistance to being made to look "just like UNIX".  Either
"read" and "write" are just wrappers around "fread" and "fwrite" in such
systems - in which case, there is NO point to providing them, other than to
provide naive porters of applications a false sense of security when porting
UNIX applications - or they are intended to get at the "raw" I/O primitives of
the system, in which case they do NOT belong in a C language standard; the
real I/O primitives on the system may not resemble those of UNIX at all (for
that matter, what *are* the "real I/O primitives" on VMS?  The RMS calls, or
the QIO calls?)

> some of which may well BREAK the usefulness
> of the ANSI C standard sufficiently as to render it totally USELESS.

If C programmers cannot refrain from using UNIX system calls when writing
applications to be run on UNIX *and* non-UNIX systems, or cannot arrange to
hide the OS dependencies in small modules, then C as a general implementation
language rather than as a UNIX-specifiic UNIX implementation language is doomed
to failure.  Fortunately, C programmers seem capable of doing both of these, so
a standard that requires you to do this is quite useful.

If you want a standard that specifies that a system look "just like UNIX", use
POSIX, not X3J11!
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com