__LINE__ is a preprocessor macro that expands to current line number in the source file, as an integer. __LINE__ is useful when generating log statements, error messages intended for programmers, when throwing exceptions, or when writing debugging code.
int logError (int line, const std::string& message)
    cerr << "[" << line << "]" << message << endl;
#define LOG( message ) logError( __LINE__, message )

// LOG can now be used to produce a log message that includes the line on which the log occurrred
The __LINE__ macro is often combined with the __FILE__ macro, which expands to the current file name.


C preprocessor tutorial