News for hackers. Stuff that matters.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by anyfoo on Thursday August 04, 2022 @07:18PM (#32349528)
That seems to be what -fstack-check for gcc is doing:

"If neither of the above are true, GCC will generate code to periodically “probe” the stack pointer using the values of the macros defined below."[1]

I guess I'm wondering why this isn't always on if it solves the problem with negligible cost? Genuine question, not trying to make a point.

[1] https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by Dylan16807 on Thursday August 04, 2022 @07:32PM (#32349635)
What I'm finding in a quick search is:

* It should be fast, but I haven't found a benchmark.

* There appear to be some issues of signals hitting at the wrong time vs. angering valgrind, depending on probe timing.

* Probes like this are mandatory on windows to make sure the stack is allocated, so it can't be that bad.

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by anyfoo on Thursday August 04, 2022 @07:36PM (#32349670)
I'm mostly interested in it for kernel code though, so the second point at least does not apply, at least not directly. Maybe there is something analogous when preempting kernel threads, I haven't thought it through at all. But interesting.
Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by Joker_vD on Friday August 05, 2022 @03:26AM (#32352842)
Because it's on by default in MSVC [0], and we all know that whatever technical decisions MS makes, they're superior to whatever technical decision the GNU people make. /s

Speaking seriously, I too would like an answer.

[0] https://docs.microsoft.com/en-us/windows/win32/devnotes/-win...

Re:C99 doesn't need function bodies, or 'VLAs are Turing com... by pjmlp on Friday August 05, 2022 @04:48AM (#32353400)
One decision Microsoft made was not to support VLAs at all, even after their new found C love.