I386 Type Attributes; An Inline Function Is As Fast As A Macro - Red Hat ENTERPRISE LINUX 4 Manual

Hide thumbs Also See for ENTERPRISE LINUX 4:
Table of Contents

Advertisement

Chapter 6. Extensions to the C Language Family
may_alias
Accesses to objects with types with this attribute are not subjected to type-based alias analysis,
but are instead assumed to be able to alias any other type of objects, just like the
-fstrict-aliasing
Example of use:
typedef short __attribute__((__may_alias__)) short_a;
int
main (void)
{
int a = 0x12345678;
short_a *b = (short_a *) &a;
b[1] = 0;
if (a == 0x12345678)
abort();
exit(0);
}
If you replaced
when compiled with
GCC versions.

6.33.1. i386 Type Attributes

Two attributes are currently defined for i386 configurations:
ms_struct
gcc_struct
If
is used on a structure, or if bit-fields are used it may be that the Microsoft ABI packs
packed
them differently than GCC would normally pack them. Particularly when moving packed data
between functions compiled with GCC and the native Microsoft compiler (either via function
call or as data in a file), it may be necessary to access either format.
Currently
-m[no-]ms-bitfields
match the native Microsoft compiler.
To specify multiple attributes, separate them by commas within the double parentheses: for example,
__attribute__ ((aligned (16), packed))

6.34. An Inline Function is As Fast As a Macro

By declaring a function
its callers. This makes execution faster by eliminating the function-call overhead; in addition, if any
of the actual argument values are constant, their known values may permit simplifications at compile
time so that not all of the inline function's code needs to be included. The effect on code size is less
predictable; object code may be larger or smaller with function inlining, depending on the particular
case. Inlining of functions is an optimization and it really "works" only in optimizing compilation. If
you don't use
, no function is really inline.
-O
Inline functions are included in the ISO C99 standard, but there are currently substantial differences
between what GCC implements and what the ISO C99 standard requires.
To declare a function inline, use the
for more information on aliasing issues.
with
short_a
short
-fstrict-aliasing
, you can direct GCC to integrate that function's code into the code for
inline
inline
in the variable declaration, the above program would abort
, which is on by default at
ms_struct
is provided for the Microsoft Windows X86 compilers to
.
keyword in its declaration, like this:
type. See
char
or above in recent
-O2
and
gcc_struct
171

Advertisement

Table of Contents
loading

Table of Contents