Can I assume a compiler for a 32 bit microcontroller supports C99 variable-length arrays?

I'm making a C library for the embedded system community.

I was wondering: In your experiences, do most people use compilers that support C99 VLA?

• Can you give a list of compilers that support C99 VLA then? What it is useful for? – Justme Nov 28 '20 at 20:46
• Yes, 32-bit systems will support this for the most part. Particularly the common ARM compilers (GCC, IAR, Keil, Clang), though YMMV for proprietary architectures. Unbounded stack allocation tends to be frowned upon though. – doynax Nov 28 '20 at 20:46
• If you want to support as many compilers as possible, use as few features of a certain standard as possible, or the oldest standard possible (but not K&R). Otherwise you will have to validate each compiler your users like to use. – the busybee Nov 29 '20 at 16:05
• @gberth if you want to know if people use compilers that supports some obscure feature X, how would they know if it supports it, unless you provide a list of compilers that support obscure feature X, so people can answer based on which compiler they use and they don't have to go search or test if obscure feature X is supported or not. What would you use VLAs for, in an embedded library? What do you consider embedded, a 64-bit ARM or 8-bit 8051, or something between? – Justme Nov 30 '20 at 16:11
• So you are writing a lib for embedded and you consider VLA but not MISRA-C? The former is kind of irrelevant, the latter is industry standard and bans VLA. – Lundin Dec 2 '20 at 7:52

C99 compilers have to support VLA, unlike C11/C17 ones that may optionally define __STDC_NO_VLA__ if they for some strange reason don't support it. So you question is a bit confused, maybe you are asking this:

Q: Do most microcontroller compilers support C99? A: Yes, all of them do unless they are legacy stuff kept for maintaining older systems. Many companies are still stuck with C90 coding standards however, running compilers in C90 mode.

Q: Do all C99 compilers support VLA?
A: Yes.

Q: Are there are C11/C17 compilers, embedded or otherwise, that doesn't support VLA?
A: I have yet to find one. All the mainstream compilers, embedded or hosted, support it.