Version Identifiers for Platforms / Architectures not supported byDMD

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 9 23:10:58 PST 2011


On Thursday, November 10, 2011 05:08:03 kennytm wrote:
> Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> > On Thursday, November 10, 2011 04:07:43 kennytm wrote:
> >> Perhaps DMD should generate a warning if a version of platforms does
> >> not
> >> have an else clause or that version's else clause's content is not
> >> another version statement or a static assert.
> > 
> > Well, that does get a bit fuzzy. For instance, rather than duplicating
> > that else clause all over the place in std.file, only the first static
> > if-else clause has the else with the static assert in it. All of the
> > others just have the branches that work and don't have an else clause.
> > If we were to require that there be an else like that, then std.file
> > wouldn't compile. And while it wouldn't be all that bad to have to put
> > an else on all of those static-ifs, it _would_ result in unnecessary
> > code duplication.
> > 
> > - Jonathan M Davis
> 
> I said version(Platform)s, not static if.

LOL. Yes. And I meant version(Platform). I obviously had my wires crossed when 
I wrote that. std.file uses

version(Posix)
{}
else version(Windows)
{}

without an else block, except for the first one in the file which _does_ have an 
else which has a static assert(0) in it. Requiring that all such version 
blocks had elses would invalidate that approach.

- Jonathan M Davis


More information about the Digitalmars-d mailing list