Re:Checked C: extension to C that adds static and dynamic ch...
by timClicks on Wednesday March 14, 2018 @11:27PM
(#16590225)
Static memory is at the bottom of the address space, below the heap. But that would really only be relevant in the case of string literals unless I'm mistaken.
[ Parent
| on HN ]
Re:Checked C: extension to C that adds static and dynamic ch...
by unwind on Thursday March 15, 2018 @04:10AM
(#16591129)
You can have a static buffer:
static char buf[128];
and use strcpy() at any point to copy into it, so I don't think statically allocated strings must be literals.
Re:Checked C: extension to C that adds static and dynamic ch...
by stochastic_monk on Thursday March 15, 2018 @09:52AM
(#16592812)
There is a distinction between const and non-const static memory, though, in that the former can be stored in Read-Only Memory. Still, static memory is generally used for many fewer purposes than the stack or the heap, and if I understand correctly, sbrk is still working with the heap, just more manually.