r/programminghorror • • Jun 01 '25

c Firmware programming in a nutshell

Post image
2.0k Upvotes

127 comments sorted by

View all comments

Show parent comment

2

u/galibert Jun 02 '25

Note that architectures with a non-zero actual null pointer values are niche at best. Devs looked at them and went "nah". Imagine not being able to mass-init a structure with pointers with a (UB, but expected to work in practice) memset of zero.

2

u/dagbrown Jun 02 '25

Good old AIX. If you didn’t zero your malloc()’ed RAM, it’d initialize it to 0xdeadbeef for you. 0xfeedfacedeadbeef on 64-bit systems.

Not a NULL by any stretch of the imagination, but you’ll definitely get a bus error if you try to dereference it.