Thread overview | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | On Tue, 13 Jul 2004 15:28:41 +1000, Matthew Wilson wrote: > What do we think of supporting #line? YES PLEASE! And #file too!. The D compiler automatically defines int #line; char[] #file; and fills in the appropriate values when used. assert("ABORT in file '" ~ #file "' at line " ~ toString(#line)) -- Derek Melbourne, Australia 13/Jul/04 3:49:48 PM |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "Matthew Wilson" <dmd@synesis.com.au> wrote in message news:ccvs29$1iu2$1@digitaldaemon.com... > What do we think of supporting #line? > Already there, www.digitalmars.com/d/lex.html#specialtokens I was thinking it should be removed and use pragma(line) instead. |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | 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 even needs it, shouldn't it be a pragma?
-- andy
|
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | On Tue, 13 Jul 2004 15:52:16 +1000, Derek Parnell wrote: > On Tue, 13 Jul 2004 15:28:41 +1000, Matthew Wilson wrote: > >> What do we think of supporting #line? > > YES PLEASE! And #file too!. > > The D compiler automatically defines > > int #line; > char[] #file; > > and fills in the appropriate values when used. > > assert("ABORT in file '" ~ #file "' at line " ~ toString(#line)) Of course I'm thinking conceptually here. The exact syntax is not an issue so I'm not fussed if its '#'xxxx or anything else. The concept is to be able to get to the source code file name and line number at 'run-time'. -- Derek Melbourne, Australia 13/Jul/04 5:06:18 PM |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | "Andy Friesen" <andy@ikagames.com> wrote in message news:ccvvum$1pi6$1@digitaldaemon.com... > 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 even needs it, shouldn't it be a pragma? The #line is there in D so that D can handle the output of the C preprocessor. |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | This is not what I mean. I meant in the same way that C/C++ compilers use it, i.e. #line N stipulates that the next line of course _is_ line N, and error messages respect that. Thus, we could generate D source from some meta-D, and use a pre-processor to generate the D using #line to keep generated code in accord with the meta-D source. "Derek Parnell" <derek@psych.ward> wrote in message news:ccvtah$1kpc$1@digitaldaemon.com... > On Tue, 13 Jul 2004 15:28:41 +1000, Matthew Wilson wrote: > > > What do we think of supporting #line? > > YES PLEASE! And #file too!. > > > The D compiler automatically defines > > int #line; > char[] #file; > > and fills in the appropriate values when used. > > assert("ABORT in file '" ~ #file "' at line " ~ toString(#line)) > > -- > Derek > Melbourne, Australia > 13/Jul/04 3:49:48 PM |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Vathix | Perfect! :-) "Vathix" <vathixSpamFix@dprogramming.com> wrote in message news:ccvvi0$1or5$1@digitaldaemon.com... > "Matthew Wilson" <dmd@synesis.com.au> wrote in message news:ccvs29$1iu2$1@digitaldaemon.com... > > What do we think of supporting #line? > > > > Already there, www.digitalmars.com/d/lex.html#specialtokens > > I was thinking it should be removed and use pragma(line) instead. > > |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy Friesen | "Andy Friesen" <andy@ikagames.com> wrote in message news:ccvvum$1pi6$1@digitaldaemon.com... > 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. Exactly. This is why I'm interested in it. > If D even needs it, shouldn't it be a pragma? #line is a well-established convention, so it'd not be wise to change from being compatible with just about any C/C++ preprocessor. |
July 13, 2004 Re: #line ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:cd02p5$1vj6$1@digitaldaemon.com... > > "Andy Friesen" <andy@ikagames.com> wrote in message news:ccvvum$1pi6$1@digitaldaemon.com... > > 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 even needs it, shouldn't it be a pragma? > > The #line is there in D so that D can handle the output of the C preprocessor. And you are a prescient super-being. :) |
Copyright © 1999-2021 by the D Language Foundation