Path: utzoo!utgpu!watmath!watdragon!dahlia!dtsteen From: dtsteen@dahlia.waterloo.edu Newsgroups: comp.lang.c Subject: calloc() Keywords: calloc null zero Message-ID: <14650@watdragon.waterloo.edu> Date: 21 Jun 89 23:41:09 GMT Sender: daemon@watdragon.waterloo.edu Distribution: na Lines: 20 I've just had a problem with an Amiga port of a Unix program (Bison) which I tracked down to the program doing effectively the following: block = calloc(0,1); As it turns out, this works fine on Unix (returning a nonzero pointer) but not with the calloc() library function of Lattice 5.02 on the Amiga, which returns a null. This makes sense, but it has made me wonder, which is the correct behaviour? Should an allocate of no memory return a null pointer or a valid pointer to no memory? The Amiga compiler claims to be ANSI compliant, and the calloc() function is one of the ANSI specified set. What does the ANSI spec (which I don't have) have to say about this? Are special cases like this even documented? Any info would be appreciated. Markus Wandel (519) 884-9669