1

I am interested in the context of C++ code, using compilers such as Clang or GCC. We saw attributes such as __attribute__((always_inline)) and also pragmas such as #pragma inline.

Since both of them provide additional information to the compiler, why would we need one over the other? Regardless of the specific feature keyword, what are the differences in the definitions of the two?

Still confused after reading some available informations:

https://stackoverflow.com/questions/37016119/can-c-attributes-be-used-to-replace-openmp-pragmas

What-is-the-difference-between-pragma-and-attribute-in-gcc

Booo
  • 493
  • 3
  • 13
  • Does this answer your question? [what is the difference between \_\_attribute\_\_((\_\_packed\_\_)); and #pragma pack(1)](https://stackoverflow.com/questions/32208805/what-is-the-difference-between-attribute-packed-and-pragma-pack1) – TruthSeeker Jan 12 '20 at 19:42
  • @TruthSeeker, thanks, it gives me new input. But, are all attributes in Clang [here](https://releases.llvm.org/7.0.0/tools/clang/docs/AttributeReference.html) because of compatibility for GCC? is there no Clang-specific attributes? – Booo Jan 12 '20 at 19:51

0 Answers0