c - Why variable length arrays need to be declared at auto storage class? -


i read in books variables use declare variable length arrays must have auto storage class.

can explain me why need variables auto storage class?

and space variable length arrays allocated in stack or heaps?

this covered in rationale international standard—programming languages—c says:

all variably modified types must declared @ either block scope or function prototype scope. file scope identifiers cannot declared variably modified type. furthermore, array objects declared either static or extern storage class specifiers cannot declared variable length array type [...]

and:

restricting variable length array declarators identifiers automatic storage duration natural since “variableness” @ file scope requires notion of parameterized typing. there sentiment allowing structure members variably modified; allowing structure members have variable length array type introduces host of problems such treatment when passing these objects, or pointers these objects, parameters. in addition, semantics of offsetof macro need extended , runtime semantics added. finally, there disagreement whether size of variable length array member determined using 1 of other members. committee decided limit variable length array types declarations outside structures , unions.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -