Directive (programming): Difference between revisions

Content deleted Content added
ʘx (talk | contribs)
It is a matter of mathematical standpoint whether pragmas are considered part of the language or not, both views are possible. AFAIK, there is no general consensus on this.
Line 1:
{{short description|Language construct that specifies how a compiler should process its input}}
{{Refimprove|date=December 2013}}
In [[computer programming]], a '''directive''' or '''pragma''' (from "pragmatic") is a [[language construct]] that specifies how a [[compiler]] (or other [[Translator (computing)|translator]]) should process its input. DirectivesDepending areon not{{disputedthe inline|Directives are part of the[[programming language in many cases|reason=In many assemblers]], directives aremay partor ofmay the grammar.|date=Novembernot 2021}}be part of the [[Formal grammar|grammar]] of a [[programmingthe language]], and may vary from compiler to compiler. They can be processed by a [[preprocessor]] to specify compiler behavior, or function as a form of in-band parameterization.
 
In some cases directives specify global behavior, while in other cases they only affect a local section, such as a block of programming code. In some cases, such as some C programs, directives are optional compiler hints, and may be ignored, but normally they are prescriptive, and must be followed. However, a directive does not perform any action in the language itself, but rather only a change in the behavior of the compiler.