More on vectorized comparisons
bearophile
bearophileHUGS at lycos.com
Fri Aug 24 06:57:41 PDT 2012
>It's just syntax sugar for a very obscure operation,<
It's an operation included in Cilk Plus, I think Intel devs know
enough what they are doing.
And I think code like this is a common need:
if (a[] > 0) {
// ...
}
>and it's somewhat ambiguous -- is it allowed to use
>short-circuit evaluation?<
That code means:
foreach (i; 0 .. a.length) {
if (a[i] > 0) {
// ...
}
}
Here I don't see problems caused by short circuit evaluation.
>You can compare scalars, but ordered comparison of vectors is a
>bit nonsensical, unless it is element-wise.<
It's a comparison element-wise between each item and a constant,
it's similar to:
a[] = a[] + 5;
Probably you have misunderstood the semantics of what I am
discussing.
Bye,
bearophile
More information about the Digitalmars-d
mailing list