3 <title>BOOST_PP_LINE
</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"../styles.css">
7 <div style=
"margin-left: 0px;">
8 The
<b>BOOST_PP_LINE
</b> macro places notes encoded as line directives in the preprocessing output.
12 #line
<b>BOOST_PP_LINE
</b>(
<i>line
</i>,
<i>file
</i>)
18 The new line number of the trailing line.
19 The predefined macro
<i>__LINE__
</i> is commonly used.
23 Typically the name of the current file.
24 However, any informative text will work.
25 This text is internally stringized, so quotation marks are unnecessary.
30 If the macro
<b>BOOST_PP_CONFIG_EXTENDED_LINE_INFO
</b> is defined as
<i>1</i> and a
<i>file-iteration
</i>
31 is in progress, this macro will automatically insert debugging information about the state of
<i>file-iteration
</i>.
32 This information will show the all of the current iteration values with the inner most iteration last.
35 This information is useful when errors might be spanning multiple iterations of the same source text.
36 Finding any errors is sometimes less than straightforward.
37 Use of this macro can provide information to make this much easier.
38 For example, instead of getting several errors like this:
40 "file.hpp", line
2: error: expected a
";"<br>
41 "file.hpp", line
4: error: improperly terminated macro invocation
<br>
43 You might get something like this instead....
45 "file.hpp [1]", line
2: error: expected a
";"<br>
46 "file.hpp [5]", line
4: error: improperly terminated macro invocation
<br>
48 It is immediately evident that this error is spanning multiple iterations of the same source text.
49 If it wasn't, the same errors would occur on each iteration.
52 It must be noted however, that some compilers don't like filenames that aren't actually files.
53 Those compilers typically issues warnings about the bad filename.
54 This makes it a good idea to only define
<b>BOOST_PP_CONFIG_EXTENDED_LINE_INFO
</b> to
<i>1</i> <i>only
</i> when debugging.
58 <li><a href=
"config_extended_line_info.html">BOOST_PP_CONFIG_EXTENDED_LINE_INFO
</a></li>
62 <b>Header:
</b> <a href=
"../headers/debug/line.html"><boost/preprocessor/debug/line.hpp
></a>
67 #if !defined(
<a href=
"is_iterating.html">BOOST_PP_IS_ITERATING
</a>)
69 #define
<a href=
"config_extended_line_info.html">BOOST_PP_CONFIG_EXTENDED_LINE_INFO
</a> 1
71 #include
<<a href=
"../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp
</a>>
72 #include
<<a href=
"../headers/cat.html">boost/preprocessor/cat.hpp
</a>>
73 #include
<<a href=
"../headers/debug/line.html">boost/preprocessor/debug/line.hpp
</a>>
74 #include
<<a href=
"../headers/iteration/iterate.html">boost/preprocessor/iteration/iterate.hpp
</a>>
78 #define
<a href=
"iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_1
</a> (
3, (
1,
5,
"sample.cpp"))
79 #include
<a href=
"iterate.html">BOOST_PP_ITERATE
</a>()
89 #line
<a href=
"line.html">BOOST_PP_LINE
</a>(
1, sample.cpp)
91 int
<a href=
"cat.html">BOOST_PP_CAT
</a>(x,
<a href=
"iteration.html">BOOST_PP_ITERATION
</a>())); // extra parenthesis
93 struct
<a href=
"cat.html">BOOST_PP_CAT
</a>(s,
<a href=
"dec.html">BOOST_PP_DEC
</a>(
<a href=
"iteration.html">BOOST_PP_ITERATION
</a>()) {
94 // missing a parenthesis
101 <div style=
"margin-left: 0px;">
102 <i>© Copyright
<a href=
"http://www.housemarque.com" target=
"_top">Housemarque Oy
</a> 2002</i>
103 </br><i>© Copyright Paul Mensonides
2002</i>
105 <div style=
"margin-left: 0px;">
106 <p><small>Distributed under the Boost Software License, Version
1.0. (See
107 accompanying file
<a href=
"../../../../LICENSE_1_0.txt">LICENSE_1_0.txt
</a> or
109 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt
</a>)
</small></p>