This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Code Generator: usage of the #line directive


I have written a code generator which takes an XML document and
generate a C++ file. The XML document contains text element which
contains C++ code. I would like to be able to locate error message
based on the start of the text element. I think the #line directive


Hmm, sorry, not going to work. #line is used to give the compiler a hint as to how many lines of source code to expect, this way it can size its caches and do memory allocations up front, thereby decreasing compile time.

On my current project, we have 583,250 lines of C++. With out a #inline, it compiles in 12min 43 seconds, but if I insert a #line 600000 compile time drops to 7min flat.

You should do some research on memory allocation, it is known in professional circles to be one of the more "expensive" activities your code can do. Also fragmentation can occur, but that is beyond the scope of this email.

_________________________________________________________________
Exercise your brain! Try Flexicon. http://games.msn.com/en/flexicon/default.htm?icid=flexicon_hmemailtaglinemarch07



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]