static if syntax
Daniel Keep
daniel.keep.lists at gmail.com
Thu Jun 4 23:39:59 PDT 2009
Steve Teale wrote:
> ...
>
> Daniel,
>
> So I have to write
>
> static if (cond1)
> {
> }
> else static if (cond2)
> {
> }
> else static if (true)
> {
> // for the default alternative?
> }
No.
> Looks a bit strange
> Steve
That's because it's wrong.
static if (cond) ... else ... is a single structure. The branch is
chosen at compile-time. It doesn't make sense for the else to somehow
not be part of the static if.
More information about the Digitalmars-d
mailing list