diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-23 07:51:16 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-01-23 07:51:16 +0000 |
commit | d3200805adb3e7c257204dc011239dacee1bae16 (patch) | |
tree | d6141c2a328bd5520c033e87b336731cf7aca2dd /gcc/doc | |
parent | 934f83cd62de15e69ced4fdc4d779df32d873dc7 (diff) | |
download | gcc-d3200805adb3e7c257204dc011239dacee1bae16.tar.gz |
PR c/3504
* doc/extend.texi: Correct documentation of __alignof__.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49126 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 94d297ed9e5..48408332bc9 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2754,27 +2754,22 @@ Some machines never actually require alignment; they allow reference to any data type even at an odd addresses. For these machines, @code{__alignof__} reports the @emph{recommended} alignment of a type. -When the operand of @code{__alignof__} is an lvalue rather than a type, the -value is the largest alignment that the lvalue is known to have. It may -have this alignment as a result of its data type, or because it is part of -a structure and inherits alignment from that structure. For example, after -this declaration: +If the operand of @code{__alignof__} is an lvalue rather than a type, +its value is the required alignment for its type, taking into account +any minimum alignment specified with GCC's @code{__attribute__} +extension (@pxref{Variable Attributes}). For example, after this +declaration: @example struct foo @{ int x; char y; @} foo1; @end example @noindent -the value of @code{__alignof__ (foo1.y)} is probably 2 or 4, the same as -@code{__alignof__ (int)}, even though the data type of @code{foo1.y} -does not itself demand any alignment. +the value of @code{__alignof__ (foo1.y)} is 1, even though its actual +alignment is probably 2 or 4, the same as @code{__alignof__ (int)}. It is an error to ask for the alignment of an incomplete type. -A related feature which lets you specify the alignment of an object is -@code{__attribute__ ((aligned (@var{alignment})))}; see the following -section. - @node Variable Attributes @section Specifying Attributes of Variables @cindex attribute of variables |