What Is #Progma Directive?

Progma is implementation specific directive that is each progma directive has different implementation rule and use. There are the many type of progma directive and varies from one compiler to another compiler. If compiler doesn't recognize particular progma. Than it ignore the progma statement without showing any error or warning message and execute.

#progma Startup
#progma exit
#progma warn
#progma inline
#progma argused
#progma hdrfile
#progma hdrstup
#progma saverage

#progma inline only tells the compiler that source code of program contain inline assembly language code.In C we can write assembly language program with help of asm keyword.

#progma warn  In C there are many warning message which can be ON or OFF with help of #progma warn


#progma warn +XXX
#progma warn -XXX
#progam warn .XXX

             +   mean ON
             -   mean OFF
             .   mean on/off toggle

XXX indicate particular warning code in three alphabet

 #progam Startup[priority]
  #progam exit[priority]


Where Priority Is Optional Integer Number.-

Progma startup always execute the function before the main function.#progam exit always execute the Function after the main function for user priority varies from 64 to 255.

 For C library priority varies from 0 to 63 Default priority is 100

void india();
void usa();

#progma startup india 105
#progma startup start usa
#progma exit Usa
#progma exit india 105

void main()

     printf("\n i am in main");

void india()
    printf("\n i am in india");

void usa()
           printf("\n i am in usa");



i am in usa
i am in india
i am in main
i am in india
i am in usa


Post a Comment

Don't Forget to comment

About Me

My photo

HI i am mohammed  a Embedded Software Developer ,SEO specialist,Electronic engineer   Read more