fwrite(buf, 0, 42, stream) == ?

Karl Heuer karl at haddock.ima.isc.com
Thu Jun 28 07:04:55 AEST 1990


In article <6818 at scolex.sco.COM> seanf at sco.COM (Sean Fagan) writes:
>In article <25105 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
>>making fwrite(, 0, n) return n is inexpensive
>
>But is it *right*?
>
>How many bytes get written for a 0-sized object?  What does ANSI say about
>it?  Do all of the committee members agree? 8-)

Since ANSI says there's no such thing as a zero-sized object, it would seem
that any behavior is right--including a core dump.  If the implementation
chooses to provide ZSOs as an extension, then the implementors should decide
on a reasonable behavior and document it.  If they want to be consistent with
other people providing similar extensions, then they should discuss it with
the X3J11 ZSO POC, which happens to be Doug Gwyn.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.std.c mailing list