emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why named structs and unions? C11 supports anonymous structs and uni


From: Daniel Colascione
Subject: Re: Why named structs and unions? C11 supports anonymous structs and unions
Date: Sun, 11 Feb 2018 20:09:14 -0800

On Feb 11, 2018 7:56 PM, Paul Eggert <address@hidden> wrote:

Daniel Colascione wrote:

> Now we get all the alignment benefits of alignas, but without the ugly "u.s." stuff.

That assumes C11, though. Currently Emacs assumes only C99. Although Emacs can
use C11 features when 'configure' determines them to work, I don't offhand see
how this could be done for this particular feature without contorting the C code
even more than it's contorted now. 

So let's require C11. I understand systems stuck on C89; we don't support those anymore. I feel like being stuck on C99 and not being able to use C11 would be much rarer. Besides: C99 compilers usually supported anonymous structs and unions as an extension. GCC, for example, supported anonymous structs and unions back in 2002, at version 3.2.

Can you think of a *real* situation where someone would be inconvenienced by our relying on this feature? Avoiding it feels like conformance for conformance's sake alone.


> Instead of XCONS(c)->car, we now write XCONS(c)->u.s.car.

Normally in C code we write XCAR (c) instead of writing either form. The u.s.
business is intended to be used only within a small set of source-code locations
that need to know the internal structure of Lisp objects, and most C code
shouldn't care whether it's '->car' or '->u.s.car'. Admittedly there are more
occurrences of '->u.s.' than we'd like.


Sure. Ideally, we'd have accessors for more things.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]