What is "__attribute__((always_inline))"?

Continuing the discussion from R4 UNO Fast ADC in Single Scan Mode:

I have encountered something else about the language that makes me curious. In the file Timer_AGT_One.h, several functions are defined like this:

  void start() __attribute__((always_inline)) {

What's curious is the __attribute__((always_inline)) part. The keyword(?) __attribute__ is not part of C++, at least as late as my Visual C++ 2019, and I can't find it in the sketch-build documentation you cited. The meaning of __attribute__((always_inline)) is obvious, but I would like to know where it is documented and see the full meaning. I am also curious about how that is different from doing it the traditional way:

class C {
...
 void Func();
...
};

inline void Func() {
...
}

It is apparent that there are several things that can go inside the parentheses; I am interested in knowing about them, too, and any other non-C++ keywords or whatever. If I hover the mouse cursor over __attribute__, the box that pops up shows only the function prototype and the names of any parameters; it says nothing about __attribute__. If I right-click __attribute__ and select Go to Definition in the pop-up menu, the cursor is merely moved to the beginning of the function name on the same line, still no help.

Do you know where I can find documentation on this and others like it?

Oops! The above code has an error. The function declaration (line 7) must be

inline void C::Func() {

It is hoped this will help: https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html

As @dougp pointed out it a GNU extension to C++ so would not show up in generic documentation.

Roger that. I am a Windows guy and am not very familiar with gcc.

Thanks.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.