5

Why does solidity (*sol) file starts with pragma? What does pragma stands for and its origins?

4

The version pragma is included because future versions of solidity will likely not be compatible with the current 0.4.* version. Specfically, 0.5.0 will likely have breaking changes.

Pragma was borrowed from other languages, such as C and C++, that use it as a preprocessor directive.

  • Compiler directive I believe, but yes. An instruction to the program processing the file, and not an instruction to be compiled. – Jamie Hale Apr 4 '18 at 12:52
0

It gives the solidity compiler a hint on how to process the code. E.g. if it should allow new features. For more general information on the usage of pragma in programming you might want to read this: https://en.wikipedia.org/wiki/Directive_(programming)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.