<div class="gmail_quote">On 16 January 2012 02:37, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Monday, January 16, 2012 02:16:03 Manu wrote:<br>
> > As for<br>
> ><br>
> > version(linux || OSX)<br>
> ><br>
> > you can use<br>
> ><br>
> > version(Posix)<br>
> ><br>
> > It'll include FreeBSD as well, but then again, if something is common to<br>
> > both<br>
> > linux and OSX, then it's almost certainly in FreeBSD as well.<br>
><br>
> Fair enough, although this is just an example.<br>
> In my current case, linux and MinGW are the same, but FreeBSD is different.<br>
> You can't rely on predefined unions.<br>
<br>
</div>True. I'm just saying that in the case of<br>
<br>
version(linux || OSX)<br>
<br>
there is a good alternative. Personally, I would have thought that using &&<br>
and || would be permitted, but it's not. But again, I'd have to dig through<br>
the archive to see what exactly Walter's arguments were except that he<br>
definitely thought that allowing && and || would lead to worse code. It<br>
probably relates to him not wanting to allow !, which I _do_ understand and<br>
agree with. Something like<br>
<br>
version(Posix)<br>
{}<br>
else version(Windows)<br>
{}<br>
else<br>
        static assert(0, "Unsupported OS");<br>
<br>
will catch bugs and save you trouble in comparison to<br>
<br>
version(Posix)<br>
{}<br>
else<br>
{}<br>
<br>
Yes, right now. Everything that isn't Posix may be Windows, but that won't<br>
necessarily always be true. So, when it comes to versioning, code should<br>
definitely be versioned on what it _is_ rather than what it _isn't_. But that<br>
doesn't preclude having && and ||. It's just an argument for disallowing !.<br>
And as you can see by my example, you can essentially _already_ do ! thanks to<br>
else.</blockquote><div><br></div><div>The list of version isn't limited to platforms though, not even close. There are a bunches of concepts in the list. Including OPTIONAL hardware features, which probably make he && operator a requirement in addition to ||.</div>
</div>