[cfe-dev] Why will clang never support all gnu99 extensions?

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 20 05:10:50 PDT 2017


On Thu, Jul 20, 2017 at 01:54:43PM +0300, Dmitry Golovin via cfe-dev wrote:
> So the two missing features are the support for nested functions and
> VLA in struct.

VLA in struct: This is insane. Think about it. You have *types* with
completely different layout depending on the way code is called. It's a
IMO completely brain dead idea. This is completely different from
flexible array members, where the struct layout remains the same and
only the allocation itself changes. Seriously, remove the commit
privileges to any developer who manages to depend on this extension.

Nested functions: There are two different situations here. With newer
GCC, you can use them as "local" function definition, i.e. moving them
out changes nothing. That's the less insane form, but I'm also only
aware of one project depending on this for non-trivial reasons
(Asterisk's RAII hack). The other form fundamentally depends on stack
trampolines, i.e. memory that is both writable and executable. It should
be obvious why this is a bad idea and why no code should be using it.

Joerg



More information about the cfe-dev mailing list