Article View: comp.std.c
Article #1432Re: fwrite(buf, 0, 42, stream) == ?
From: Doug Gwyn
Date: Thu, 14 Jun 1990 18:46
Date: Thu, 14 Jun 1990 18:46
22 lines
1524 bytes
1524 bytes
In article <F.-&asi@cs.psu.edu> flee@psuvax1.cs.psu.edu (Felix Lee) writes: >Doug Gwyn wrote: >>Strictly speaking, there are no semantics defined for such usage, >Well, does that mean it's undefined or implementation defined? If the >standard defines malloc(0), why not fwrite(p, 0, n, stream)? It doesn't define semantics for malloc(0) either, for exactly the same reason (the argument is the size of an object, and there are no zero- sized objects). The only requirement is that malloc() return either a pointer to at least zero bytes of (distinguishable) allocated storage or that it return a NULL pointer; the implementation may choose to do the latter. As POC for the zero-sized object extensions special interest group, I would be happier if semantics for dealing with zero-sized objects had been included in the standard, but a deliberate decision was made to outlaw them. >Urmf. If sizeof(char [n]) != n, then I can't use (c) either. But sizeof(char[n]) is n, since the byte (char) is the basic unit of storage in standard C and sizeof(char)==1 is a requirement.
Technical Details
Message-ID:
<13114@smoke.BRL.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!aplcen!haven!adm!smoke!gwynReferences:
<Fkucoph@cs.psu.edu> <13094@smoke.BRL.MIL> <F.-&asi@cs.psu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: fwrite(buf, 0, 42, stream) == ? Message-ID: <13114@smoke.BRL.MIL> Date: 14 Jun 90 18:46:05 GMT References: <Fkucoph@cs.psu.edu> <13094@smoke.BRL.MIL> <F.-&asi@cs.psu.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 22