public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: наб <nabijaczleweli@nabijaczleweli.xyz>
Cc: linux-man@vger.kernel.org,
	"G. Branden Robinson" <g.branden.robinson@gmail.com>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: [PATCH 2/2] alloca.3: rewrite NOTES
Date: Tue, 24 Aug 2021 13:18:01 +0200	[thread overview]
Message-ID: <b57c352b-7b95-a4ec-e398-6922c3248bc7@gmail.com> (raw)
In-Reply-To: <74071710-9981-21aa-4be8-b4ee988d7210@gmail.com>

Hi, Ahelenia!

On 8/24/21 12:33 PM, Alejandro Colomar (man-pages) wrote:
> 
> And apart from what Michael (and Branden) already said, I have one 
> question that has not been treated before it seems:
> 
> AFAIK, VLAs are 100% equivalent to alloca() (except for the obvious 
> syntax differences).  And considering the VLA syntax is much nicer than 
> alloca(), and is in the standard (IIRC, C99 added VLAs, and C11 declared 
> them optional), what about adding a NOTES subsection that recommends (or 
> at least mentions) VLAs?
> 
> And they both share the problem of smashing the stack if you try to 
> allocate an array to big (and none of them has a way to check if it will 
> happen, AFAIK).

Now that I think, there's a slight difference, of course:  VLAs live in 
their block scope, while alloca() lives in the function scope, allowing 
to embed it in a macro such as strdupa().

But maybe still worth mentioning VLAs in alloca(3).

Cheers,

Alex


-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

  reply	other threads:[~2021-08-24 11:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 21:01 [PATCH 1/2] strdup.3: drop mention of "the GNU GCC suite" наб
2021-08-23 21:01 ` [PATCH 2/2] alloca.3: rewrite NOTES наб
2021-08-24  9:50   ` Michael Kerrisk (man-pages)
2021-08-24 10:04     ` G. Branden Robinson
2021-08-24 11:58       ` наб
2021-08-24 10:33     ` Alejandro Colomar (man-pages)
2021-08-24 11:18       ` Alejandro Colomar (man-pages) [this message]
2021-08-25 18:21       ` наб
2021-08-24 11:47     ` наб
2021-08-24  9:21 ` [PATCH 1/2] strdup.3: drop mention of "the GNU GCC suite" Michael Kerrisk (man-pages)
2021-08-24 10:28   ` наб
2021-08-24 10:40     ` Alejandro Colomar (man-pages)
2021-09-14 12:40 ` [PATCH v2 0/5] alloca(3) commentary re-write наб
2021-09-14 12:40   ` [PATCH v2 1/5] strdup.3: drop mention of "the GNU GCC suite" наб
2021-09-15 19:49     ` Alejandro Colomar (man-pages)
2021-09-14 12:41   ` [PATCH v2 2/5] alloca.3: clarify origins in CONFORMING TO наб
2021-09-15 19:49     ` Alejandro Colomar (man-pages)
2021-09-14 12:41   ` [PATCH v2 3/5] alloca.3: clarify reasoning for no error return in BUGS наб
2021-09-15 19:42     ` Alejandro Colomar (man-pages)
2021-09-17 20:35       ` наб
2025-10-29  8:42       ` G. Branden Robinson
2025-10-29 10:15         ` Alejandro Colomar
2025-10-29 10:30           ` G. Branden Robinson
2025-10-29 10:58             ` Alejandro Colomar
2025-10-29 11:12               ` G. Branden Robinson
2025-10-29 11:23                 ` Alejandro Colomar
2025-10-29 15:22         ` наб
2025-10-29 22:55           ` G. Branden Robinson
2021-09-14 12:41   ` [PATCH v2 4/5] alloca.3: remove GCC faffling from NOTES наб
2021-09-15 19:48     ` Alejandro Colomar (man-pages)
2021-09-17 20:45       ` наб
2021-09-19 19:39         ` Alejandro Colomar (man-pages)
2021-09-14 12:41   ` [PATCH v2 5/5] alloca.3: simplfy malloc(3) suite comparison, note VLAs наб

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b57c352b-7b95-a4ec-e398-6922c3248bc7@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=g.branden.robinson@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=nabijaczleweli@nabijaczleweli.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox