@luc0x61@mastodon.gamedev.place
Post #1957620
2026-05-03 20:36 UTC
Replies (1)
-
@thejpster@hachyderm.io 2026-05-03 20:45
@luc0x61 You've moved the goalposts. You said anyone with good sense doesn't use a heap in C. I spent years working on satellite telephone and modem firmware, and they all used dynamic allocation because it was the best solution for the problem at hand. The engineers on that firmware certainly were not lacking good sense. I'm well aware of MISRA C, ISO 26262 and IEC 61508 and yes, dynamic memory allocation carries certain risks that often rule it out under those workflows. However, the paper was explicitly about writing an IoT firmware that exchanges JSON messages with a cloud service and was not safety-crtitical. I would *hate* to write a JSON stack that didn't have dynamic memory allocation, because C has null-terminated strings and pulling a string out of a buffer requires null-terminating it (or exercising extreme care and attention). I think using a heap is absolutely a valid choice for their use case.