emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC


From: Stefan Monnier
Subject: Re: emacs-26 9e59de9: Use GCALIGNED properly for GCC
Date: Fri, 10 Nov 2017 11:23:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>   union gcaligned_foo { struct foo s; int64_t gcaligned; };

Are int64_t necessarily aligned on multiples of 8 on 32bit platforms?

> IOW, should we rely on alignas?  There could be dragons there too, no?

FWIW, for the dummy alignment thingy I wouldn't use `char` (I wouldn't be
surprised to see errors in compilers when asking to align on multiples
of N for objects smaller than N), so maybe

    #define gc_aligned(typename) \
       union { typename s; int64_t alignas (GCALIGNMENT) dummy; };

I'm not super happy about the "64" in there (which hardcodes basically
the value of GCALIGNMENT).  Depending on how alignas can be used to
impose alignment of an array, we could try:

    typedef char gcsized_t[GCALIGNMENT];
    #define gc_aligned(typename) \
       union { typename s; gcsized_t alignas (GCALIGNMENT) dummy; }

but maybe getting rid of this 64 is not that important.


        Stefan




reply via email to

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