does #pragma startup work in c?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chandru
    New Member
    • Aug 2006
    • 5

    does #pragma startup work in c?

    [code=c]void first();
    void last();

    #pragma startup first
    #pragma exit last

    #include<stdio. h>

    main()
    {
    printf("I m in main");
    }

    void first()
    {
    printf("I m in first");
    }

    void last()
    {.
    printf("i m in last");
    }
    [/code]
    When i m running this program i did not get the desired result this only prints

    i m in main does #pragma work in c?

    I have compiled this code using both turbo c and visual studio compilers
    Last edited by sicarie; Jul 17 '08, 01:39 PM. Reason: Code tags are [code=c] and after your code [/code]. Please use them. They want to be used. They like to be used.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Pragmas are not just compiler vendor specific, they're also version specific; when
    a compiler implementation doesn't implement a certain pragma it is supposed to
    ignore it. Read your compiler's user manual.

    kind regards,

    Jos

    Comment

    • chandru
      New Member
      • Aug 2006
      • 5

      #3
      Thanks for ur reply. could u tell me about the turboc compiler version which one has the #pragma startup directive ?

      Thanks in advance

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by chandru
        Thanks for ur reply. could u tell me about the turboc compiler version which one has the #pragma startup directive ?

        Thanks in advance
        I don't know; I don't use any TurboC compiler but I think what you want to
        accomplish can also be accomplished by:

        [code=c]
        int main() {
        first();
        ...
        last();
        return 0;
        }
        [/code]

        kind regards,

        Jos

        Comment

        Working...