version: multiple conditions

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 13 14:16:04 PDT 2015


On Saturday, 13 June 2015 at 20:57:14 UTC, bitwise wrote:
> What is the rationale for not allowing multiple version 
> conditions?
>
> Example:
>
> version(iOS || Android) {
>     pthread_create(...)
> }
> else version(Win32) {
>     CreateThread(...)
> }
>
> I wasn't able to find the conversations on this.
>
> I heard rumors in DLearn that Walter was against this, but I'm 
> wondering if the sentiment has changed at this point. Is there 
> is any wiggle room for at least adding "||" so that code can be 
> shared between platforms?
>
>
> This is trivial to do in C, C++, and even C#:
>
> #if OS_IOS || OS_ANDROID
>    ...
> #elif OS_WINDOWS
>
> #endif
>
>
> In Rust, there is attributes for this:
>
> #[cfg(any(not(unix), all(target_os="macos", target_arch = 
> "powerpc")))]
> void something() {
>
> }
>
> I haven't yet seen a solution in D that justifies not having 
> this feature.
>
>
> Thanks,
>   Bit

iirc this falls under the "walter dislikes it so we won't have 
it" category.


More information about the Digitalmars-d mailing list