Proposal for SentinelInputRange
Steven Schveighoffer
schveiguy at yahoo.com
Thu Feb 28 09:25:06 PST 2013
On Thu, 28 Feb 2013 12:00:48 -0500, Walter Bright
<newshound2 at digitalmars.com> 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.
A sample case of 1 does not prove it's not possible, or explain why those
optimizers don't take that step. A valid response would be to give a case
why an optimizer COULDN'T make that leap.
> Then try the lookahead cases I also posted.
You have already stated it gets changed into a jump table. Such an
optimization seems possible to me, even with the != 0 check outside the
switch, even if not all C compilers employ it.
-Steve
More information about the Digitalmars-d
mailing list