[llvm-dev] Building aggregate types with dynamically sized elements

David Chisnall via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 14 03:03:54 PDT 2017


On 14 Jul 2017, at 10:55, Alexander Benikowski <sebal007 at googlemail.com> wrote:
> 
>> Note: C does not support this.  GCC has an extension (variable length arrays in structs), but clang doesn’t support it and it’s a terrible idea.
> It might be complex but it is not terrible. Depends on the language capabilities implementing it. Delphi for example allows exactly that and finalizes its records through RTTI which allows to automatically free up the memory.

The Pascal type system, unlike C, does not erase array lengths in various places, so doing the same thin in Pascal would be far less problematic than C.  That doesn’t alter the fact that it’s a terrible idea for C, where it encourages to error-prone code.

David



More information about the llvm-dev mailing list