10.25 __declspec(noinline)

The __declspec(noinline) attribute suppresses the inlining of a function at the call points of the function.

__declspec(noinline) can also be applied to constant data, to prevent the compiler from using the value for optimization purposes, without affecting its placement in the object. This is a feature that can be used for patchable constants, that is, data that is later patched to a different value. It is an error to try to use such constants in a context where a constant value is required. For example, an array dimension.


This __declspec attribute has the function attribute equivalent __attribute__((noinline)).


/* Prevent y being used for optimization */
__declspec(noinline) const int y = 5;
/* Suppress inlining of foo() wherever foo() is called */
__declspec(noinline) int foo(void);
Related reference
10.39 __attribute__((noinline)) function attribute
10.64 __attribute__((noinline)) constant variable attribute
10.89 #pragma inline, #pragma no_inline
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.