Directive (programming): Difference between revisions

Content deleted Content added
 
Line 63:
** <code>Option Infer On|Off</code> - When on enables the compiler to infer the type of local variables from their initializers.
* In [[Ruby (programming language)|Ruby]], interpreter directives are referred to as '''pragmas''' and are specified by top-of-file comments that follow a <code>key: value</code> notation. For example, <code>coding: UTF-8</code> indicates that the file is encoded via the [[UTF-8]] [[character encoding]].
* In [[C Sharp (programming language)|C#]], compiler directives are called pre-processing directives. C# does not technically handle these using a preprocessor, but rather directly in the code. There are a number of different compiler directives, which mostly align with those from C and C++, including <code>#pragma</code>, which is specifically used to control compiler warnings and debugger checksums.<ref>{{Cite web|url=https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure|title=Lexical structure - C# language specification|last=dotnet-bot|website=docs.microsoft.com|language=en-us|access-date=2019-11-01}}</ref><ref>{{Cite web|url=https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma|title=#pragma - C# Reference|last=BillWagner|website=docs.microsoft.com|language=en-us|access-date=2019-11-01}}</ref> C# also features some directives not used in C or C++, including <code>#nullable</code> and <code>#region</code>. C# also does not allow function-like macros, but does allow regular macros, for purposes such as conditional compilation.
* The [[SQLite]] [[DBMS]] includes a PRAGMA directive that is used to introduce commands that are not compatible with other DBMS.<ref>{{cite web |title=Pragma statements supported by SQLite |url=https://www.sqlite.org/pragma.html |website=www.sqlite.org}}</ref>
* In [[Solidity]], compiler directives are called pragmas, and are specified using the `pragma` keyword.<ref>{{Cite web |title=Layout of a Solidity Source File — Solidity 0.8.27 documentation |url=https://docs.soliditylang.org/en/latest/layout-of-source-files.html#pragmas |access-date=2024-06-03 |website=docs.soliditylang.org}}</ref>