variant length array?

Bernd Petrovitsch bernd at petrovitsch.priv.at
Wed Apr 6 06:51:16 EDT 2016


Hi!

On Die, 2016-04-05 at 15:29 -0400, Wenda Ni wrote:
[...]
> I come across the following code in a kernel module code. It defines an
> array whose length is variant at runtime, depending on the actual inputs.
> It seems that kernel compiler supports this, which is obvious an error in
> the standard ANSI C. Do I have the correct understanding on it?

ANSI-C ist old and enforced with -std=c89 with gcc (see manual page).
VLAs are allowed since (standard) C99.

	Bernd
-- 
"What happens when you read some doc and either it doesn't answer your
question or is demonstrably wrong? In Linux, you say "Linux sucks" and
go read the code. In Windows/Oracle/etc you say "Windows sucks" and
start banging your head against the wall."    - Denis Vlasenko on lkml





More information about the Kernelnewbies mailing list