Copyright (C) 2000-2012 |
GNU Info (gcc-295.info)Other BuiltinsOther built-in functions provided by GNU CC =========================================== GNU CC provides a large number of built-in functions other than the ones mentioned above. Some of these are for internal use in the processing of exceptions or variable-length argument lists and will not be documented here because they may change from time to time; we do not recommend general use of these functions. The remaining functions are provided for optimization purposes. GNU CC includes builtin versions of many of the functions in the standard C library. These will always be treated as having the same meaning as the C library function even if you specify the `-fno-builtin' (Note: C Dialect Options.) option. These functions correspond to the C library functions `alloca', `ffs', `abs', `fabsf', `fabs', `fabsl', `labs', `memcpy', `memcmp', `strcmp', `strcpy', `strlen', `sqrtf', `sqrt', `sqrtl', `sinf', `sin', `sinl', `cosf', `cos', and `cosl'. You can use the builtin function `__builtin_constant_p' to determine if a value is known to be constant at compile-time and hence that GNU CC can perform constant-folding on expressions involving that value. The argument of the function is the value to test. The function returns the integer 1 if the argument is known to be a compile-time constant and 0 if it is not known to be a compile-time constant. A return of 0 does not indicate that the value is *not* a constant, but merely that GNU CC cannot prove it is a constant with the specified value of the `-O' option. You would typically use this function in an embedded application where memory was a critical resource. If you have some complex calculation, you may want it to be folded if it involves constants, but need to call a function if it does not. For example: #define Scale_Value(X) \ (__builtin_constant_p (X) ? ((X) * SCALE + OFFSET) : Scale (X)) You may use this builtin function in either a macro or an inline function. However, if you use it in an inlined function and pass an argument of the function as the argument to the builtin, GNU CC will never return 1 when you call the inline function with a string constant or constructor expression (Note: Constructors.) and will not return 1 when you pass a constant numeric value to the inline function unless you specify the `-O' option. automatically generated by info2www version 1.2.2.9 |