This is the mail archive of the gcc@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: __alignof__(void)


> Date: Tue, 08 Sep 1998 17:46:02 +0100
> From: Nathan Sidwell <nathan@acm.org>
> To: egcs@cygnus.com

> What is a desirable value for __alignof__(void) to return?

> IMHO a useful value to return would be the maximum alignment for any
> type.

There are three possibilities, 0, 1, or the above.  The above is
really many different values, the maximum alignment of any ANSI C
named type, any regular GNU named type, any possibly named type, and
the maximum alignment permitted by the executable format.  The last is
subject to change overtime, and hence, isn't a good value for any
portable program to ever see or know.  Also, do you count types like
int __attribute__((__mode__(__OI__))), even though the don't have
names and are poorly supported and can't be aligned by the object file
format?

I distinctly don't like the last possibility.  0 or 1 is fine.  1 is
surprising generally, but if you buy into sizeof(void)==1, then it is
less so.


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