* Conditionals:: Omitting the middle operand of a @samp{?:} expression.
* Long Long:: Double-word integers---@code{long long int}.
* Complex:: Data types for complex numbers.
-* Decimal Float:: Decimal Floating Point.
+* Decimal Float:: Decimal Floating Types.
* Hex Floats:: Hexadecimal floating-point constants.
* Zero Length:: Zero-length arrays.
* Variable Length:: Arrays whose length is computed at run time.
examine and set these two fictitious variables with your debugger.
@node Decimal Float
-@section Decimal Floating Point
-@cindex decimal floating point
+@section Decimal Floating Types
+@cindex decimal floating types
@cindex @code{_Decimal32} data type
@cindex @code{_Decimal64} data type
@cindex @code{_Decimal128} data type
@cindex @code{DD} integer suffix
@cindex @code{DL} integer suffix
-GNU C supports decimal floating point types in addition to the
-standard floating-point types. This extension supports decimal
-floating-point arithmetic as defined in IEEE-754R, the proposed
-revision of IEEE-754. The C language extension is defined in ISO/IEC
-DTR 24732, Draft 5. Support for this functionality will change when
-it is accepted into the C standard and might change for new drafts
-of the proposal. Calling conventions for any target might also change.
-Not all targets support decimal floating point.
+As an extension, the GNU C compiler supports decimal floating types as
+defined in the N1176 draft of ISO/IEC WDTR24732. Support for decimal
+floating types in GCC will evolve as the draft technical report changes.
+Calling conventions for any target might also change. Not all targets
+support decimal floating types.
-Support for decimal floating point includes the arithmetic operators
+The decimal floating types are @code{_Decimal32}, @code{_Decimal64}, and
+@code{_Decimal128}. They use a radix of ten, unlike the floating types
+@code{float}, @code{double}, and @code{long double} whose radix is not
+specified by the C standard but is usually two.
+
+Support for decimal floating types includes the arithmetic operators
add, subtract, multiply, divide; unary arithmetic operators;
relational operators; equality operators; and conversions to and from
-integer and other floating-point types. Use a suffix @samp{df} or
+integer and other floating types. Use a suffix @samp{df} or
@samp{DF} in a literal constant of type @code{_Decimal32}, @samp{dd}
or @samp{DD} for @code{_Decimal64}, and @samp{dl} or @samp{DL} for
@code{_Decimal128}.
-Passing a decimal floating-point value as an argument to a function
-without a prototype is undefined.
+GCC support of decimal float as specified by the draft technical report
+is incomplete:
+
+@itemize @bullet
+@item
+Translation time data type (TTDT) is not supported.
+
+@item
+Characteristics of decimal floating types are defined in header file
+@file{decfloat.h} rather than @file{float.h}.
+
+@item
+When the value of a decimal floating type cannot be represented in the
+integer type to which it is being converted, the result is undefined
+rather than the result value specified by the draft technical report.
+@end itemize
Types @code{_Decimal32}, @code{_Decimal64}, and @code{_Decimal128}
are supported by the DWARF2 debug information format.
This attribute specifies how a particular function is called on
ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options})
command line switch and @code{#pragma long_calls} settings. The
-@code{long_call} attribute causes the compiler to always call the
-function by first loading its address into a register and then using the
-contents of that register. The @code{short_call} attribute always places
+@code{long_call} attribute indicates that the function might be far
+away from the call site and require a different (more expensive)
+calling sequence. The @code{short_call} attribute always places
the offset to the function from the call site into the @samp{BL}
instruction directly.
@item longcall/shortcall
@cindex functions called via pointer on the RS/6000 and PowerPC
-On the Blackfin, RS/6000 and PowerPC, the @code{longcall} attribute causes
-the compiler to always call this function via a pointer, just as it would if
-the @option{-mlongcall} option had been specified. The @code{shortcall}
-attribute causes the compiler not to do this. These attributes override
-both the @option{-mlongcall} switch and, on the RS/6000 and PowerPC, the
-@code{#pragma longcall} setting.
+On the Blackfin, RS/6000 and PowerPC, the @code{longcall} attribute
+indicates that the function might be far away from the call site and
+require a different (more expensive) calling sequence. The
+@code{shortcall} attribute indicates that the function is always close
+enough for the shorter calling sequence to be used. These attributes
+override both the @option{-mlongcall} switch and, on the RS/6000 and
+PowerPC, the @code{#pragma longcall} setting.
@xref{RS/6000 and PowerPC Options}, for more information on whether long
calls are necessary.
and objects, because in C++ types have linkage. A class must not have
greater visibility than its non-static data member types and bases,
and class members default to the visibility of their class. Also, a
-declaration must not have greater visibility than its type.
+declaration without explicit visibility is limited to the visibility
+of its type.
In C++, you can mark member functions and static member variables of a
class with the visibility attribute. This is useful if if you know a
particular method or static member variable should only be used from
one shared object; then you can mark it hidden while the rest of the
class has default visibility. Care must be taken to avoid breaking
-the One Definition Rule; for example, it is not useful to mark a
-method which is defined inside a class definition as hidden without
-marking the whole class as hidden.
+the One Definition Rule; for example, it is usually not useful to mark
+an inline method as hidden without marking the whole class as hidden.
A C++ namespace declaration can also have the visibility attribute.
This attribute applies only to the particular namespace body, not to
Otherwise, template instantiations and specializations default to the
visibility of their template.
+If both the template and enclosing class have explicit visibility, the
+visibility from the template is used.
+
@item warn_unused_result
@cindex @code{warn_unused_result} attribute
The @code{warn_unused_result} attribute causes a warning to be emitted
to be possibly unused. GCC will not produce a warning for this
variable.
+@item used
+This attribute, attached to a variable, means that the variable must be
+emitted even if it appears that the variable is not referenced.
+
@item vector_size (@var{bytes})
This attribute specifies the vector size for the variable, measured in
bytes. For example, the declaration:
addresses).
@end table
+@anchor{i386 Variable Attributes}
@subsection i386 Variable Attributes
Two attributes are currently defined for i386 configurations:
@end enumerate
@end table
+@subsection PowerPC Variable Attributes
+
+Three attributes currently are defined for PowerPC configurations:
+@code{altivec}, @code{ms_struct} and @code{gcc_struct}.
+
+For full documentation of the struct attributes please see the
+documentation in the @xref{i386 Variable Attributes}, section.
+
+For documentation of @code{altivec} attribute please see the
+documentation in the @xref{PowerPC Type Attributes}, section.
+
@subsection Xstormy16 Variable Attributes
One attribute is currently defined for xstormy16 configurations:
above in recent GCC versions.
@item visibility
-
In C++, attribute visibility (@pxref{Function Attributes}) can also be
applied to class, struct, union and enum types. Unlike other type
attributes, the attribute must appear between the initial keyword and
the name of the type; it cannot appear after the body of the type.
+Note that the type visibility is applied to vague linkage entities
+associated with the class (vtable, typeinfo node, etc.). In
+particular, if a class is thrown as an exception in one shared object
+and caught in another, the class must have default visibility.
+Otherwise the two shared objects will be unable to use the same
+typeinfo node and exception handling will break.
+
@subsection ARM Type Attributes
On those ARM targets that support @code{dllimport} (such as Symbian
@code{__attribute__} instead of @code{__declspec} if you prefer, but
most Symbian OS code uses @code{__declspec}.)
+@anchor{i386 Type Attributes}
@subsection i386 Type Attributes
Two attributes are currently defined for i386 configurations:
double parentheses: for example, @samp{__attribute__ ((aligned (16),
packed))}.
+@anchor{PowerPC Type Attributes}
+@subsection PowerPC Type Attributes
+
+Three attributes currently are defined for PowerPC configurations:
+@code{altivec}, @code{ms_struct} and @code{gcc_struct}.
+
+For full documentation of the struct attributes please see the
+documentation in the @xref{i386 Type Attributes}, section.
+
+The @code{altivec} attribute allows one to declare AltiVec vector data
+types supported by the AltiVec Programming Interface Manual. The
+attribute requires an argument to specify one of three vector types:
+@code{vector__}, @code{pixel__} (always followed by unsigned short),
+and @code{bool__} (always followed by unsigned).
+
+@smallexample
+__attribute__((altivec(vector__)))
+__attribute__((altivec(pixel__))) unsigned short
+__attribute__((altivec(bool__))) unsigned
+@end smallexample
+
+These attributes mainly are intended to support the @code{__vector},
+@code{__pixel}, and @code{__bool} AltiVec keywords.
+
@node Inline
@section An Inline Function is As Fast As a Macro
@cindex inline functions
@smallexample
#define foo(x) \
(@{ \
- typeof (x) tmp; \
+ typeof (x) tmp = (x); \
if (__builtin_types_compatible_p (typeof (x), long double)) \
tmp = foo_long_double (tmp); \
else if (__builtin_types_compatible_p (typeof (x), double)) \