[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdalign and alignof
From: |
Bruno Haible |
Subject: |
Re: stdalign and alignof |
Date: |
Tue, 1 Nov 2011 12:48:35 +0100 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
Paul Eggert wrote on 2011-10-27:
> none of this stuff affects the existing
> alignof module. Perhaps the documentation for each should
> refer to the other? Maybe alignof should use stdalign?
The highest priority is to fix the conflict between the two modules,
that now both define an alignof() macro. Fixed through this patch.
Maybe alignof could use stdalign? Maybe. Not very urgent; it's only
a few lines of code duplication.
2011-11-01 Bruno Haible <address@hidden>
alignof: Avoid collision with stdalign module.
* lib/alignof.h (alignof): Remove macro.
* NEWS: Mention the change.
Reported by Paul Eggert.
--- NEWS.orig Tue Nov 1 12:41:37 2011
+++ NEWS Tue Nov 1 12:39:03 2011
@@ -12,6 +12,9 @@
Date Modules Changes
+2011-11-01 alignof This module no longer provides the alignof() macro.
+ Use either alignof_slot() or alignof_type()
instead.
+
2011-11-01 openat This module no longer provides the fchownat()
function. If you need this function, you now need
to request the 'fchownat' module.
--- lib/alignof.h.orig Tue Nov 1 12:41:37 2011
+++ lib/alignof.h Tue Nov 1 12:37:47 2011
@@ -20,8 +20,11 @@
#include <stddef.h>
-/* Determine the alignment of a structure slot (field) of a given type,
+/* alignof_slot (TYPE)
+ Determine the alignment of a structure slot (field) of a given type,
at compile time. Note that the result depends on the ABI.
+ This is the same as alignof (TYPE) and _Alignof (TYPE), defined in
+ <stdalign.h> if __alignof_is_defined is 1.
Note: The result cannot be used as a value for an 'enum' constant,
due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
#if defined __cplusplus
@@ -31,7 +34,8 @@
# define alignof_slot(type) offsetof (struct { char __slot1; type __slot2; },
__slot2)
#endif
-/* Determine the good alignment of an object of the given type at compile time.
+/* alignof_type (TYPE)
+ Determine the good alignment of an object of the given type at compile time.
Note that this is not necessarily the same as alignof_slot(type).
For example, with GNU C on x86 platforms: alignof_type(double) = 8, but
- when -malign-double is not specified: alignof_slot(double) = 4,
@@ -44,10 +48,4 @@
# define alignof_type alignof_slot
#endif
-/* alignof is an alias for alignof_slot semantics, since that's what most
- callers need.
- Note: The result cannot be used as a value for an 'enum' constant,
- due to bugs in HP-UX 10.20 cc and AIX 3.2.5 xlc. */
-#define alignof alignof_slot
-
#endif /* _ALIGNOF_H */
--
In memoriam Stefano Peluffo
<http://www.marxists.org/history/international/comintern/sections/italy/1944/partisans.htm>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: stdalign and alignof,
Bruno Haible <=