This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: __alignof__(void) -> most strict alignment



Nathan --

>>>>> "Nathan" == Nathan Sidwell <nathan@acm.org> writes:

    Nathan> This is a multi-part message in MIME format.

    Nathan> --------------782A4D632DBA Content-Type: text/plain;
    Nathan> charset=us-ascii Content-Transfer-Encoding: 7bit

    Nathan> hi, This patch changes the (currently unspecified)
    Nathan> behaviour of the gcc extension __alignof__(void). It
    Nathan> currently returns 1, this changes it to return the value
    Nathan> BIGGEST_ALIGNMENT / BITS_PER_UNIT, i.e. the most strict
    Nathan> alignment required on the target. Such a value is needed
    Nathan> in, for instance, memory allocators.

Personally, I'm not big on this extension; I'd be much happier if
alignof and sizeof void were errors as one would expect with standard
C/C++.  (void is an incomplete type.)  The information you require
could be made as a builtin function, and I think this would be a
cleaner approach.  But, as you mentioned, we've all argued this
before, so I suppose it's now in the hands of our esteemed
maintainers.

That aside, I think your patch should contain patches to the
documentation; if we're going to provide an extension to GCC we should
at least make sure it's a well-defined and documented one!  (Yes, I
know that alignof is already a GCC extension, but the behavior you are
suggesting is not intuitive, to me, given the name `alignof', so I
think of this as an extension-to-an-extension...)

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]