* Alejandro Colomar: > I think everybody agrees that glibc's calloc(3) is conforming to C11, > and it behaves like my proposal suggests. > > alx@debian:~/tmp$ cat c.c > #include <stdio.h> > #include <stdlib.h> > > int > main(void) > { > printf("%p\n", calloc(0, 42)); > perror("calloc(0, 42)"); > > printf("%p\n", calloc(42, 0)); > perror("calloc(42, 0)"); > > printf("%p\n", calloc(0, 0)); > perror("calloc(0, 0)"); > } > alx@debian:~/tmp$ gcc c.c > alx@debian:~/tmp$ ./a.out > 0x564b188332a0 > calloc(0, 42): Success > 0x564b188338d0 > calloc(42, 0): Success > 0x564b18833d00 > calloc(0, 0): Success > > In any case, I've improved the wording to be more explicit about it. > See alx-0029r6.
I think the wording still allows calloc (42, 0) to fail with EINVAL (or some other error code) because 0 is not a valid object size. Thanks, Florian