RFC acceptable handling of VLAs across toolchains
Tyler Retzlaff
roretzla at linux.microsoft.com
Wed Nov 8 04:25:04 CET 2023
On Tue, Nov 07, 2023 at 06:31:14PM -0800, Stephen Hemminger wrote:
> On Tue, 7 Nov 2023 11:32:20 -0800
> Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
>
> > hi folks,
> >
> > i'm seeking advice. we have use of VLAs which are now optional in
> > standard C. some toolchains provide a conformant implementation and msvc
> > does not (and never will).
> >
> > we seem to have a few options, just curious about what people would
> > prefer.
> >
> > * use alloca
> >
> > * use dynamically allocated storage
> >
> > * conditional compiled code where the msvc leg uses one of the previous
> > two options
> >
> > i'll leave it simple for now, i'd like to hear input rather than provide
> > a recommendation for now.
> >
>
> VLAs are a bug magnet. Best to avoid them, most code doesn't need them.
just in case i didn't clarify properly early when i said they were
optional i meant they used to be non-optional. the intent of the RFC
here isn't that i want to add more but i'm looking for the best approach
to getting rid of the ones we already have.
> The one common use case is code that accepts a burst of packets.
> But such code could easily have an upper bound if necessary.
>
> Please don't add more to the maze of #ifdef's
thanks! i'll keep this in mind.
More information about the dev
mailing list