Thread: _line_????????????

  1. #1
    Registered User jacktibet's Avatar
    Join Date
    Mar 2003
    Posts
    18

    Question _line_????????????

    in linux

    #include <stdio.h>

    main()
    {

    printf("\n This print is from line %d of file %s",_LINE_,_FILE_);

    }

    i use cc and gcc, but it prompt _LINE_ and _FILE_ is undefined,
    but _LINE_,_FILE_,_DATE_ and _TIME_ are predefined macro?

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    According to the MSDN, __LINE__, __FILE__, __DATE__, __STDC__, __TIME__, __TIMESTAMP__ are all predefined ANSI C macros. The trick is that there are two underscore characters '_' before and after these macros and it looks as though you may have only put a single character before and after in your examples.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User jacktibet's Avatar
    Join Date
    Mar 2003
    Posts
    18

    thanx

    can you tell me what is __STDC__ and what type is it?

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    76
    The macro __STDC__ is defined if a compiler supports the ANSI C standard.

    The macro __TIMESTAMP__ is both the build date and the build time.

Popular pages Recent additions subscribe to a feed