Skip to content

Add include for NULL definition - #32

Closed
swaldhoer wants to merge 1 commit into
ThrowTheSwitch:masterfrom
swaldhoer:patch-1
Closed

Add include for NULL definition#32
swaldhoer wants to merge 1 commit into
ThrowTheSwitch:masterfrom
swaldhoer:patch-1

Conversation

@swaldhoer

Copy link
Copy Markdown

Add include <stddef.h> as NULL currently is only included by accident through some other headers.

Add #include <stddef.h>
mvandervoord added a commit that referenced this pull request Aug 24, 2026
@mvandervoord

Copy link
Copy Markdown
Member

I fixed this issue by replacing the NULL with a cross-platform standard 0. Thanks for pointing out the issue! I just pivoted to a more universal solution (sadly giving up some clarity in the test, but the test name still describes it!)

@swaldhoer
swaldhoer deleted the patch-1 branch August 25, 2026 07:16
@swaldhoer

Copy link
Copy Markdown
Author

Out of curiosity, why was simply including stddef.h not the chosen solution? stddef.h is required by the standard since C89/C90 to define NULL.

@mvandervoord

Copy link
Copy Markdown
Member

Hi @swaldhoer, because there are still embedded libraries that don't support all the standard libraries, particularly the type-related defines, etc. We've found that, to get the widest support, we aim for a dumbed-down ANSI-C-ish standard that avoids most of the standard libraries. Honestly, if we could avoid using setjmp and still be portable, we probably would. But this works for most situations, so we're going with it. It's not perfect, but it seems to be an acceptable line most of the time.

@swaldhoer

Copy link
Copy Markdown
Author

Okay thanks for the clarificarion...however, wild to hear, that there are embedded compilers missing the most basic headers 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants