C++ Preprocessor: What are '__FILE__' and '__LINE__'?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: C++ Preprocessor: What are '__FILE__' and '__LINE__'?

Hybrid View

  1. #1
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    C++ Preprocessor: What are '__FILE__' and '__LINE__'?

    Q: What are '__FILE__' and '__LINE__'?

    A: '__FILE__' and '__LINE__' are predefined macros and part of the C/C++ standard. During preprocessing, they are replaced respectively by a constant string holding the current file name and by a integer representing the current line number.

    There are other preprocessor variables including:
    • '__DATE__' -> a string literal of the form "Mmm dd yyyy"

    • '__TIME__' -> a string literal of the form "hh:mm:ss"

    • '__TIMESTAMP__' -> a string literal of the form "Mmm dd yyyy hh:mm:ss"

    • '__FUNCTION__' -> a string literal which contains the function name (this is part of C99, the new C standard and not all C++ compilers support it)


    FAQ contributed by: [Kevin Hall] [Axter]



    Last edited by Andreas Masur; July 23rd, 2005 at 02:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center