Commit 5372b3fb by Neil Booth Committed by Neil Booth

re PR c/3504 (__alignof__ not working correctly)

	PR c/3504
	* doc/extend.texi: Correct documentation of __alignof__.

From-SVN: r49126
parent 9b6e0e57
2002-01-23 Neil Booth <neil@daikokuya.demon.co.uk>
PR c/3504
* doc/extend.texi: Correct documentation of __alignof__.
2002-01-22 Zack Weinberg <zack@codesourcery.com> 2002-01-22 Zack Weinberg <zack@codesourcery.com>
* params.h: Rename arguments of DEFPARAM so that it will be * params.h: Rename arguments of DEFPARAM so that it will be
......
...@@ -2754,27 +2754,22 @@ Some machines never actually require alignment; they allow reference to any ...@@ -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__} data type even at an odd addresses. For these machines, @code{__alignof__}
reports the @emph{recommended} alignment of a type. reports the @emph{recommended} alignment of a type.
When the operand of @code{__alignof__} is an lvalue rather than a type, the If the operand of @code{__alignof__} is an lvalue rather than a type,
value is the largest alignment that the lvalue is known to have. It may its value is the required alignment for its type, taking into account
have this alignment as a result of its data type, or because it is part of any minimum alignment specified with GCC's @code{__attribute__}
a structure and inherits alignment from that structure. For example, after extension (@pxref{Variable Attributes}). For example, after this
this declaration: declaration:
@example @example
struct foo @{ int x; char y; @} foo1; struct foo @{ int x; char y; @} foo1;
@end example @end example
@noindent @noindent
the value of @code{__alignof__ (foo1.y)} is probably 2 or 4, the same as the value of @code{__alignof__ (foo1.y)} is 1, even though its actual
@code{__alignof__ (int)}, even though the data type of @code{foo1.y} alignment is probably 2 or 4, the same as @code{__alignof__ (int)}.
does not itself demand any alignment.
It is an error to ask for the alignment of an incomplete type. 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 @node Variable Attributes
@section Specifying Attributes of Variables @section Specifying Attributes of Variables
@cindex attribute of variables @cindex attribute of variables
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment