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

Boyd Roberts boyd at necisa.ho.necisa.oz
Fri Jun 15 15:09:43 AEST 1990


In article <F.-&asi at cs.psu.edu> flee at 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)?
>

Like the man said `there are no semantics defined'.

Successfully writing `n' objects of zero size?  Just where will it all end?

I can see it now, `Programming in C+++':

    fp = fopen("/dev/null", "r+");
    p = malloc(0);
    fread(p, 0, 42, fp);
    p += 0;
    fwrite(p, 0, 42, fp);

Choose a better _algorithm_ and leave library routine breaking to the experts.


Boyd Roberts			boyd at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.std.c mailing list