In GCC with the C ++ method defined in the header file, can attribute syntax be used? Can someone set an example for me, please. The following code does not work:
class foo { public: void my_func() __attribute__((hot)); void my_func() {
It seems that you should put the attributes in the declaration, not in the function definition. When you define a method / function in the header file, you do not have a separate declaration.
Also how to use this with templates. For example, the following code cannot compile with an error: attributes are not allowed to define a function.
/// Template version of max for type T template <typename T> inline T max(const T x, const T y) __attribute((const)) { if (x > y) return x; else return y; }
c ++ gcc powerpc
Shanecook
source share