Oracle® Solaris Studio 12.4: C++ User's Guide

Exit Print View

Updated: March 2015
 
 

4.11 Supported Attributes

The following are supported attributes:The following attributes, invoked by __attribute__ ((keyword)), or alternatively by [[keyword]], are implemented by the compiler for compatibility. Spelling the attribute keyword within double underscores, __keyword__, is also accepted.

aligned

Roughly equivalent to #pragma align. Generates a warning and is ignored if used on variable length arrays.

always_inline

Equivalent to #pragma inline and -xinline

const

Equivalent to #pragma no_side_effect

constructor

Equivalent to #pragma init

deprecated(msg)

Results in a warning if the type, variable, or function is used in the source file. The optional argument msg must be a string literal and will be included in the warning message.

destructor

Equivalent to #pragma fini

malloc

Equivalent to #pragma returns_new_memory

mode

(No equivalent)

noinline

Equivalent to #pragma no_inline and -xinline

noreturn

Equivalent to #pragma does_not_return

pure

Equivalent to #pragma does_not_write_global_data

packed

Equivalent to #pragma pack(). See details below.

returns_twice

Equivalent to #pragma unknown_control_flow

strong

Accepted for compatibility with g++, but has no effect. The g++ documentation recommends not using this attribute.

vector_size

Indicates that a variable or a type name (created using typedef) represents a vector.

visibility

Provides linker scoping. (See -xldscope={v}) Syntax is: __attribute__((visibility(“visibility-type”))), where visibility-type is one of:

default

Same as __global linker scoping

hidden

Same as __hidden linker scoping

internal

Same as __symbolic linker scoping

weak

Equivalent to #pragma weak