3 ms·
Um, no? That COPY_MAX would still need a different value between small MCU and full-blown PC. Not to mention that using stack allocation on low-memory device i
by theamk 7y ago
Um, no? That COPY_MAX would still need a different value between small MCU and full-blown PC.
Not to mention that using stack allocation on low-memory device is extremely dangerous... at least with malloc you get a nice diagnostic, while alloca will just do random program damage.
- bdisnainc 7y agoIt does not do random damage, you get a segmentation fault in most systems. In really small embedded you should not be allocating anything meaningful in the stack anyway.
- Gibbon1 7y agoIn small embedded things are either statically allocated or allocated on the stack. There is no heap.
- lonelappde 7y agoIsn't that like choosing your poison? If you have a low memory device, you need to statically guarantee safety and reject oversized inputs. Crashing your embedded device may work if your are a server with a client that knows to retry another backend, but isn't an elegant solution if it disables your car's brakes.