[Bug preprocessor/58687] "#line __LINE__ ..." changes subsequent line numbers

mtewoodbury at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Nov 30 05:07:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58687

--- Comment #25 from Max TenEyck Woodbury <mtewoodbury at gmail dot com> ---
(In reply to joseph@codesourcery.com from comment #24)
> ...
> 
> I don't believe the standard makes any such attempt to accommodate such a 
> (marginal) need;

GAG! Without this, a number of problems associated with externally developed 
development environments are very difficult, if not impossible, to manage.  
It is ultimately a portability problem; there must be a way to identify the 
source for the code that is independent of the particulars of the build 
environment and at the same time not change the line sequencing without forcing 
the code maintainers to maintain a count of code lines.  That puts this problem 
squarely in the middle of the domain of problems that language standards were 
developed to address!

>  the wording is simply the most natural way to describe 
> the possible forms of #line directive within the style used by the 
> standard.  Note there are no examples in the standard to indicate any 
> particular intent regarding corner cases of #line or __LINE__.

The 'natural' way to say this would be much closer to the way it was expressed 
in K&R.  Someone went to a great deal of trouble to rephrase it for some 
reason and, at least in my opinion, that reason included the interaction of 
__LINE__ and directives.



More information about the Gcc-bugs mailing list