[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ISO opposes variable-length arrays???
From: |
Richard Stallman |
Subject: |
Re: ISO opposes variable-length arrays??? |
Date: |
Tue, 22 Oct 2024 01:38:41 -0400 |
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> A. VLAs make code less safe, due to problems with stack overflow and
> related issues. There is no portable way for a program to detect and
> recover from memory exhaustion, and indeed in many implementations
> (including default GNU, if I'm not mistaken) the system does not even
> detect memory exhaustion reliably - the program merely has undefined
> behavior instead. This dangerous behavior is particularly important in
> multithreaded apps where each thread has a relatively small stack.
Is that any worse with VLAs than with `alloca'?
If not, we may as well use VLAs instead.
> B. They make code a bit slower.
Slower than what alternative? Using `malloc' to allocate the array?
Using `alloca'? And in what way is it slower? Is there a case where
the slowdown is significant?
Anyway, I'm glad that the feature remains as "optional". That is much
less of a steb backwards than what I first thought was the case.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)