News for hackers. Stuff that matters.
Re:The C23 edition of Modern C is now available for free by johnisgood on Wednesday October 16, 2024 @01:10AM (#41855812)
Well, I always include stdio.h which includes stddef.h that defines NULL as (void *)0.
Re:The C23 edition of Modern C is now available for free by dhhfss on Wednesday October 16, 2024 @01:43AM (#41855960)
In my experience, hardly any source files require studio.h

stddef.h on the other hand is required by most to get size_t

Re:The C23 edition of Modern C is now available for free by johnisgood on Wednesday October 16, 2024 @10:11AM (#41859219)
You are right. Hereby I correct my parent comment: I talked about my own personal experience[1], but yeah, as you said, stddef.h is often required (and yes, often I do not need stdio.h, stddef.h is what I need) which defines NULL, which was my point. If it is often required, then it does not matter whether you have to include a header file or not, IMO.

Just include the stddef.h header if you want to use NULL, similarly to how you include a header file if you want to use anything else, e.g. bool from stdbool.h.

[1] I am not entirely sure in retrospect, actually, as I might be misremembering, but my point stands with or without stdio.h!