alelievr / libft-unit-test

456 stars 88 forks source link

ft_calloc: may return NULL when size or count are zero #127

Closed ghost closed 1 year ago

ghost commented 2 years ago

calloc(0, 0) may return NULL as per the C specification ( and as reflected by e.g. https://linux.die.net/man/3/calloc ), so the test that checks it against non-NULL is bogus.

github-actions[bot] commented 2 years ago

Hello! Thanks for contributing to the libft unit test.

Note that this repository is not maintained by the owner anymore, instead there is a bot that will automatically merge any reviewed pull requests. If you feel like it, here are some links that can help you submiting a change in the code base::

ghost commented 1 year ago

FWIW, it would appear (currently, a best guess based on a failing ft_calloc) the moulinette in Lausanne does not accept NULL as a result for ft_calloc even when count or size are zero, so I figure this is a useful test despite its theoretical incorrectness.