So I know what pragma is, and what it's used for, but what is the meaning of the word itself? I've used it many times in code, but I never really knew what the word actually means or stands for.
The term pragmatism is derived from the Greek word pragma - πράγμα, meaning action, from which the words 'practice' and 'practical' come.
5. Pragma, or longstanding love. The use of the ancient Greek root pragma as a form of love was popularized by the Canadian sociologist John Allen Lee in the 1970s, who described it as a mature, realistic love that is commonly found amongst long-established couples.
A pragma is a compiler directive that allows you to provide additional information to the compiler. This information can change compilation details that are not otherwise under your control. For example, the pack pragma affects the layout of data within a structure. Compiler pragmas are also called directives.
The use of #pragma once can reduce build times, as the compiler won't open and read the file again after the first #include of the file in the translation unit. It's called the multiple-include optimization.
According to a US Government-owned(!) document describing the design of Ada: Rationale for the Design of the Ada® Programming Language :
A pragma (from the Greek word meaning action) is used to direct the actions of the compiler in particular ways, but has no effect on the semantics of a program (in general).
I like the (last caveat) there...
This cross references well with on-line greek dictionaries (e.g. as quoted by Martin York) that say pragma (πράγμα, as commented on the original question by asveikau) means:
Seems the key to understanding is the word action rather than information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With