Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
September 19, 2004 [DMD 0.101] Version statement without else clause within if crashes compiler | ||||
---|---|---|---|---|
| ||||
This code causes the compiler to crash: void foo () { if (x) version (none) foo; } The specification doesn't say what a collapsed version/debug statement turns into, so I don't know how it's supposed to behave. |
September 19, 2004 Re: [DMD 0.101] Version statement without else clause within if crashes compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons wrote:
> This code causes the compiler to crash:
>
> void foo ()
> {
> if (x)
> version (none)
> foo;
> }
>
> The specification doesn't say what a collapsed version/debug statement turns into, so I don't know how it's supposed to behave.
I think this leads to an incorrect program, as version (none) becomes nothing:
void foo ()
{
if (x)
}
which is wrong because there is no statement following if (x). The compiler shouldn't crash, though.
Lars Ivar Igesund
|
September 19, 2004 Re: [DMD 0.101] Version statement without else clause within if crashes compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | It's fixed now. It turns into: if (x) ; |
September 27, 2004 Re: [DMD 0.101] Version statement without else clause within if crashes compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | In article <cil2q3$1l6i$1@digitaldaemon.com>, Walter says... > >It's fixed now. It turns into: > > if (x) ; You mean you've changed it so that that's valid D syntax? Stewart. |
September 28, 2004 Re: [DMD 0.101] Version statement without else clause within if crashes | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lars Ivar Igesund | In article <cikkvs$1f9n$1@digitaldaemon.com>, Lars Ivar Igesund says... > Burton Radons wrote: > >> This code causes the compiler to crash: >> >> void foo () >> { >> if (x) >> version (none) >> foo; >> } <snip> > void foo () > { > if (x) > } > > which is wrong because there is no statement following if (x). The compiler shouldn't crash, though. The D versioning system isn't a text preprocessor. As such, it is pointless to try and think of version blocks as reducing to textual nothingness. Rather, it reduces to semantic nothingness, an effective 'nop' statement. Another way to think of it is by imagining that there are braces: void foo() { if (x) { version (none) { foo; } } } The statement forms if ( Expression ) Statement if ( Expression ) { Statement } are identical in effect, By converting to the latter, it is easy to see the result of version reduction. Stewart. |
September 30, 2004 Re: [DMD 0.101] Version statement without else clause within if crashes compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "Stewart Gordon" <Stewart_member@pathlink.com> wrote in message news:cj9ltc$16k1$1@digitaldaemon.com... > In article <cil2q3$1l6i$1@digitaldaemon.com>, Walter says... > > > >It's fixed now. It turns into: > > > > if (x) ; > > You mean you've changed it so that that's valid D syntax? No. I meant: if (x) { } |
Copyright © 1999-2021 by the D Language Foundation