version and extern problems
Georg Wrede
georg at nospam.org
Mon Jul 9 02:15:58 PDT 2007
Walter Bright wrote:
> Bug 1311 http://d.puremagic.com/issues/show_bug.cgi?id=1311
> is about using version declarations to control part of a following
> declaration (or series of declarations):
>
> -------------------------
> version(Windows)
> extern(Windows):
> else
> extern(C):
>
> typedef void function() foo;
> --------------------------
>
> This does not work now, and it was a bug that it ever did appear to
> work. The issue is that version declarations can only affect entire
> declarations, not parts of them. An extern statement with a : is
> implicitly the same as:
>
> ----------------
> extern(Windows):
> int a;
> int b;
> -----is same as---
> extern(Windows)
> {
> int a;
> int b;
> }
> -----------------
>
> That cannot be split up with a version declaration;
Why not
extern(ecc) void function() foo;
where ecc would resolve to Windows or C.
This of course requires some tweaking of the compiler, but it might be
worth it.
More information about the Digitalmars-d
mailing list