/www.cppreference.com/wiki/preprocessor/preprocessor_vars
#! | 84 lines | 74 code | 10 blank | 0 comment | 0 complexity | 10dc93fc01f8e288da1d1272aa703449 MD5 | raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
- lang="en" dir="ltr">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>preprocessor:preprocessor_vars</title>
- <meta name="generator" content="DokuWiki" />
- <meta name="robots" content="index,follow" />
- <meta name="date" content="2010-10-28T18:17:02-0700" />
- <meta name="keywords" content="preprocessor,preprocessor_vars" />
- <link rel="search" type="application/opensearchdescription+xml" href="http://www.cppreference.com/wiki/lib/exe/opensearch.php" title="C++ Reference" />
- <link rel="start" href="../../index.html" />
- <link rel="contents" href="http://www.cppreference.com/wiki/preprocessor/preprocessor_vars?do=index" title="Sitemap" />
- <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="http://www.cppreference.com/wiki/feed.php" />
- <link rel="alternate" type="application/rss+xml" title="Current Namespace" href="http://www.cppreference.com/wiki/feed.php?mode=list&ns=preprocessor" />
- <link rel="alternate" type="text/html" title="Plain HTML" href="http://www.cppreference.com/wiki/_export/xhtml/preprocessor/preprocessor_vars" />
- <link rel="alternate" type="text/plain" title="Wiki Markup" href="http://www.cppreference.com/wiki/_export/raw/preprocessor/preprocessor_vars" />
- <link rel="canonical" href="preprocessor_vars" />
- <link rel="stylesheet" media="screen" type="text/css" href="../lib/exe/css.php@t=custom1&tseed=1289693594" />
- <link rel="stylesheet" media="all" type="text/css" href="../lib/exe/css.php@s=all&t=custom1&tseed=1289693594" />
- <link rel="stylesheet" media="print" type="text/css" href="../lib/exe/css.php@s=print&t=custom1&tseed=1289693594" />
- <script type="text/javascript" ><!--//--><![CDATA[//><!--
- var NS='preprocessor';var JSINFO = {"id":"preprocessor:preprocessor_vars","namespace":"preprocessor"};
- //--><!]]></script>
- <script type="text/javascript" charset="utf-8" src="../lib/exe/js.php@tseed=1289693594" ></script>
- </head>
- <body>
- <div class="dokuwiki export">
- <h2 class="sectionedit1"><a name="predefined_preprocessor_variables" id="predefined_preprocessor_variables">Predefined preprocessor variables</a></h2>
- <div class="level2">
- <p>
- Syntax:
- </p>
- <pre class="cpp code cpp"> __LINE__
- __FILE__
- __DATE__
- __TIME__
- __cplusplus
- __STDC__</pre>
- <p>
- The following variables can vary by compiler, but generally work:
- </p>
- <ul>
- <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>
- </li>
- <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>
- </li>
- <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>
- </li>
- <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>
- </li>
- <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>
- </li>
- </ul>
- </div>
- <!-- EDIT1 SECTION "Predefined preprocessor variables" [1-938] -->
- <h3 class="sectionedit2"><a name="gcc-specific_variables" id="gcc-specific_variables">GCC-specific variables</a></h3>
- <div class="level3">
- <p>
- 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:
- </p>
- <ul>
- <li class="level1"><div class="li"> <code>__func__</code> contains the bare name of the function</div>
- </li>
- <li class="level1"><div class="li"> <code>__FUNCTION__</code> is another name for <code>__func__</code></div>
- </li>
- <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>
- </li>
- </ul>
- </div>
- <!-- EDIT2 SECTION "GCC-specific variables" [939-] --></div>
- </body>
- </html>