GNU Attributes

From RAD Studio
Jump to: navigation, search

Go Up to C++ Specifics Index

C++Builder supports the following GNU attributes:

  • aligned (ALIGNMENT) [documented below]
  • cdecl
  • stdcall
  • dllimport
  • dllexport
  • alias ("name")
  • const
  • constructor
  • destructor
  • eightbit_data
  • exception (EXCEPT-FUNC [, EXCEPT-ARG])
  • format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)
  • format_arg (STRING-INDEX)
  • function_vector
  • interrupt
  • interrupt_handler
  • longcall
  • model (MODEL-NAME)
  • noreturn
  • regparm (NUMBER)
  • section ("section-name")
  • tiny_data
  • unused
  • weak

Note: To use the GNU attributes, compile the C++ code with the -AG flag. See BCC32.EXE, the C++ 32-bit Command-Line Compiler and C++ Compiler (language compliance).

aligned (ALIGNMENT)

Use this attribute to force the minimum alignment of a specific data block.

Example:

// flags: -AG
struct Coordinate
{
	int x, y, z;
};
Coordinate c __attribute__((aligned (8)));

Note: To set the general data alignment, open Project Options > C++ Compiler > General Compilation > Data Alignment. See the compiler option -a.

See Also