PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/www.cppreference.com/wiki/preprocessor/preprocessor_vars

https://github.com/tsgates/cclookup
#! | 84 lines | 74 code | 10 blank | 0 comment | 0 complexity | 10dc93fc01f8e288da1d1272aa703449 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
  4. lang="en" dir="ltr">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>preprocessor:preprocessor_vars</title>
  8. <meta name="generator" content="DokuWiki" />
  9. <meta name="robots" content="index,follow" />
  10. <meta name="date" content="2010-10-28T18:17:02-0700" />
  11. <meta name="keywords" content="preprocessor,preprocessor_vars" />
  12. <link rel="search" type="application/opensearchdescription+xml" href="http://www.cppreference.com/wiki/lib/exe/opensearch.php" title="C++ Reference" />
  13. <link rel="start" href="../../index.html" />
  14. <link rel="contents" href="http://www.cppreference.com/wiki/preprocessor/preprocessor_vars?do=index" title="Sitemap" />
  15. <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="http://www.cppreference.com/wiki/feed.php" />
  16. <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="http://www.cppreference.com/wiki/feed.php?mode=list&amp;ns=preprocessor" />
  17. <link rel="alternate" type="text/html" title="Plain HTML" href="http://www.cppreference.com/wiki/_export/xhtml/preprocessor/preprocessor_vars" />
  18. <link rel="alternate" type="text/plain" title="Wiki Markup" href="http://www.cppreference.com/wiki/_export/raw/preprocessor/preprocessor_vars" />
  19. <link rel="canonical" href="preprocessor_vars" />
  20. <link rel="stylesheet" media="screen" type="text/css" href="../lib/exe/css.php@t=custom1&amp;tseed=1289693594" />
  21. <link rel="stylesheet" media="all" type="text/css" href="../lib/exe/css.php@s=all&amp;t=custom1&amp;tseed=1289693594" />
  22. <link rel="stylesheet" media="print" type="text/css" href="../lib/exe/css.php@s=print&amp;t=custom1&amp;tseed=1289693594" />
  23. <script type="text/javascript" ><!--//--><![CDATA[//><!--
  24. var NS='preprocessor';var JSINFO = {"id":"preprocessor:preprocessor_vars","namespace":"preprocessor"};
  25. //--><!]]></script>
  26. <script type="text/javascript" charset="utf-8" src="../lib/exe/js.php@tseed=1289693594" ></script>
  27. </head>
  28. <body>
  29. <div class="dokuwiki export">
  30. <h2 class="sectionedit1"><a name="predefined_preprocessor_variables" id="predefined_preprocessor_variables">Predefined preprocessor variables</a></h2>
  31. <div class="level2">
  32. <p>
  33. Syntax:
  34. </p>
  35. <pre class="cpp code cpp"> __LINE__
  36. __FILE__
  37. __DATE__
  38. __TIME__
  39. __cplusplus
  40. __STDC__</pre>
  41. <p>
  42. The following variables can vary by compiler, but generally work:
  43. </p>
  44. <ul>
  45. <li class="level1"><div class="li"> The <code>__LINE__</code> and <code>__FILE__</code> variables represent the current line and current file being processed.</div>
  46. </li>
  47. <li class="level1"><div class="li"> The <code>__DATE__</code> variable contains the current date, in the form month/day/year. This is the date that the file was compiled, not necessarily the current date.</div>
  48. </li>
  49. <li class="level1"><div class="li"> The <code>__TIME__</code> variable represents the current time, in the form hour:minute:second. This is the time that the file was compiled, not necessarily the current time.</div>
  50. </li>
  51. <li class="level1"><div class="li"> The <code>__cplusplus</code> variable is only defined when compiling a C++ program. In some older compilers, this is also called <code>c_plusplus</code>.</div>
  52. </li>
  53. <li class="level1"><div class="li"> The <code>__STDC__</code> variable is defined when compiling a C program, and may also be defined when compiling C++.</div>
  54. </li>
  55. </ul>
  56. </div>
  57. <!-- EDIT1 SECTION "Predefined preprocessor variables" [1-938] -->
  58. <h3 class="sectionedit2"><a name="gcc-specific_variables" id="gcc-specific_variables">GCC-specific variables</a></h3>
  59. <div class="level3">
  60. <p>
  61. The following are GCC-specific variables. While they are not specifically preprocessor macros they are <a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html" class="urlextern" title="http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html" rel="nofollow">magic</a> and can be used the same way:
  62. </p>
  63. <ul>
  64. <li class="level1"><div class="li"> <code>__func__</code> contains the bare name of the function</div>
  65. </li>
  66. <li class="level1"><div class="li"> <code>__FUNCTION__</code> is another name for <code>__func__</code></div>
  67. </li>
  68. <li class="level1"><div class="li"> The <code>__PRETTY_FUNCTION__</code> contains the type signature of the function as well as its bare name. </div>
  69. </li>
  70. </ul>
  71. </div>
  72. <!-- EDIT2 SECTION "GCC-specific variables" [939-] --></div>
  73. </body>
  74. </html>