The #pragma directive, why is it called such?

I would ask about the #pragma , what is this for? And why is it called as such?

+4
source share
3 answers

Pragmatic modules or pragmatics for brevity or pragmas for a shorter impact on the compilation of your program.

It is called that way because the compiler should handle it pragmatically.

Pragma was introduced in Ada 83 in 1983 and reused in many computer languages ​​since (C, perl, ECMAScript, PL / SQL ...)

Justification for naming appears in the document Justification for Development Ada® Programming Language .

The term pragmatism comes from the Greek word pragma - πράγμα, meaning the action from which the words "practice" and "practicality" come.

The Pragmatism Movement was introduced into philosophy by Mr. Charles Pearce in 1878 and was called "Pragmatism" by William James in 1898.

+8
source

As AL is written, but you need to learn a little more about the wiki :

Another C constructor, the #pragma directive, is used to tell the compiler to use pragmatic or implementation-dependent functions . The two most famous users of this directive are OpenMP and OpenHMPP

0
source

Basically, the compiler can ignore #pragma -s, and your program will still behave the same as with them. In practice, evil is in the details, and it is not so simple (there are dirty exceptions).

And you usually don't need #pragma -s. I coded in C for 30 years and almost never used them.

0
source

All Articles