Embedding C Code-Promela

Embedding C Code: Promela supports the use of embedded C code fragments inside the models through the use of the c_code primitive.

12_c code.jpg

For example:

2413_c code2.jpg

If the logical expression is specified, its value is evaluated before the c_code fragment inside the curly braces is executed. If the result of the assessment is non-zero, the c_code fragment is executed. If the outcome of the evaluation is zero, the code between curly braces is ignored, and the statement is treated as an assertion violation. The example above adds checks for null pointers and bounds on array indices.

Many other code verifiers which do not necessarily use Promela as their modeling language use SPIN as a back-end verifier.

   Related Questions in Programming Languages

  • Q : Explain shell variables Explain the

    Explain the shell variables?

  • Q : Define Constant Constant : It is the

    Constant: It is the memory block where value can be stored once although can’t modify later on throughout program execution. Example: const int pi =3.14;

  • Q : Rings present in CPU What do you mean

    What do you mean by rings present in CPU?

  • Q : Define Sign bit Sign bit : In

    Sign bit: In 2s-complement notation, the most important bit in an integer value is employed to determine the sign of the value. A 1-bit point out a negative number and a 0 bit point out a positive number.

  • Q : Explain Upcast Upcast: It is a cast

    Upcast: It is a cast towards an object's ultimate super type - which is, `up' the inheritance hierarchy towards the Object class, for example:         // Upcast from VariableContr

  • Q : What is an Initializer Initializer : A

    Initializer: A block stated at the outermost level of a class - identical to a method devoid of a header. The initializer blocks are executed, in order, whenever an instance is formed. They are executed prior to the constructor of the defining class,

  • Q : What is High level programming language

    High level programming language: Languages like Ada, Java, C++, and so on which give programmers with features like control structures, classes, methods, packages, and so forth. Such features are mostly independent of any specific instruction set, and

  • Q : Explain a quality and metrics reporting

    What opinion would you provide to someone who asked you where to begin to introduce to their company a quality and metrics reporting program?

  • Q : Explain Throws clause Throws clause :

    Throws clause: It is a clause in a method header pointing that one or additional exceptions will be propagated from this technique. For example:    public int find(String s) throws NotFoundExc

©TutorsGlobe All rights reserved 2022-2023.