July 14, 2004
Andy Friesen wrote:

> Matthew Wilson wrote:
> 
>> What do we think of supporting #line?
> 
> 
> The only use for it I can think of is for tricking the compiler into outputting 'correct' line numbers and filenames in error messages when compiling code that is the output of some preprocessor.

If D is successful, it will be the target language for other compilers.  For example, consider Yacc/Bison - that generates C code; a D version might be useful, one day.  Lex/Flex is a closely related example, of course.  And I've worked with a number of other languages that use C as an intermediate (not necessarily the only intermediate) language.  And it helps the original language compiler (the one that generates C or D) to get the error reporting right if the lower-level compiler (C or D) reports line numbers in terms of the original language -- hence #line.

> If D even needs it, shouldn't it be a pragma?

Pass.

-- 
Jonathan Leffler                   #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
1 2 3
Next ›   Last »