Proposal for SentinelInputRange

Timon Gehr timon.gehr at gmx.ch
Thu Feb 28 14:48:16 PST 2013


On 02/28/2013 11:17 PM, Walter Bright wrote:
> On 2/28/2013 10:12 AM, deadalnix wrote:
>> On Thursday, 28 February 2013 at 17:00:51 UTC, Walter Bright wrote:
>>> On 2/28/2013 6:31 AM, Steven Schveighoffer wrote:
>>>> If this doesn't translate to the same code, I don't know why not.
>>>
>>> Try it and see with your favorite C compiler.
>>>
>>> Then try the lookahead cases I also posted.
>>
>> You are being stubborn here.
>>
>> You claim that this is significantly faster, but give no numbers.
>> You claim that the compiler can't do some optimization, when LLVM does
>> it already.
>
> I didn't say can't, I said didn't. llvm handles that case (which does
> surprise me), dmc, gcc, and vc do not. Furthermore, I'll say "cannot" on
> this:
>
>              case '|':
>                  p++;
>                  if (*p == '=')
>                  {   p++;
>                      t->value = TOKorass;
>                  }
>                  else if (*p == '|')
>                  {   p++;
>                      t->value = TOKoror;
>                  }
>                  else
>                      t->value = TOKor;
>                  return;

Why not? It boils down to a little CSE and a trivial implies check in an 
and expression.


More information about the Digitalmars-d mailing list