version and extern problems

torhu fake at address.dude
Sun Jul 8 09:19:10 PDT 2007


torhu wrote:
> Mike Wey wrote:
>> Should this work?
>> 
>> version(Windows)
>> {   const char[] external = "extern(Windows):"; }
>> else
>> {   const char[] external = "extern(C):"; }
>> 
>> mixin(external);
>> typedef void function() foo;
>> 
> 
> DMD 1.018 accepts that.  But maybe that's a bug too, since string mixins 
> are supposed to be either an expression, a statement, or a declaration 
> or definition?  According to the spec, it seems to be a valid 
> AttributeSpecifier, which in turn is a valid DeclDef.  But Walter didn't 
> suggest it as a workaround, which makes me worried.

That the mixing trick works might be as bad as that this works:

---
version (Windows)
     extern (Windows):
---


Being able to insert 'extern (Windows):' using a string mixin seems 
equally bad to me.  Where's the important difference?



More information about the Digitalmars-d mailing list