C++ '__FILE__' and '__LINE__
2011-07-28 15:24
369 查看
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)
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)
相关文章推荐
- filegroup reference and partitioning scheme' is not supported in this version of sql server.
- C++ difference of keywords 'typename' and 'class' in templates
- Xilinx's ibis and pkg file
- centos安装nginx 报错:cp: `conf/koi-win' and `/usr/local/nginx/conf/koi-win' are the same file
- Python标准库:内置函数open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=T
- dpkg: error: parsing file '/var/lib/dpkg/updates/0002' near line 0:newline in field name `#padding'
- fatal error C1001: INTERNAL COMPILER ERROR(compiler file 'msc1.cpp', line 1786)解决方法
- Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable
- Visual C++ Debugging: How to use 'ASSERT' and deal with assertions failures?
- There are inconsistent line endings in the 'xxx' script. Some are Mac OS X (UNIX) and some are Windows
- C++ Dos and Don'ts
- 'ADB server didn't ACK'的解决办法 , Binary XML file line #...: Error inflating class ...。
- Command line error D2016 : '/ZI' and '/O2' command-line options are incompatible 解决办法
- python print'hello' File "<stdin>",line 1 print 'hello' SyntaxError:invalid syntax
- fatal error C1001:INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786)
- Non-ASCII character '\xe8' in file xxx.py on line 8, but no encoding declared
- HHC4003: Warning:The following option line does not contain an '=' character separating the option and its value: 锘縖OPTIONS]
- warning: here-document at line 17 delimited by end-of-file (wanted `EOF')
- 使用友元,编译出错fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) 的解决
- files list file for package '*****' is missing final newline的解决