Proposal for SentinelInputRange
Walter Bright
newshound2 at digitalmars.com
Thu Feb 28 08:36:42 PST 2013
On 2/28/2013 6:48 AM, Ary Borenszweig wrote:
> On 2/28/13 1:57 AM, Walter Bright wrote:
>> On 2/27/2013 8:01 PM, John Colvin wrote:
>>> Why must sentinel be known at compile time? I don't see what's in the
>>> way of it
>>> being a runtime argument.
>>
>> Performance!
>>
>> It should be usable as a case in a switch statement.
>
> Isn't it possible for the optimizer to inline the function call and then combine
> the next ifs?
>
> if (isSentinel(value)) {
> } else {
> switch(value) {
> case ...
> }
> }
1. I don't know of any C compiler that would do that.
2. There are other cases, as I pointed out to deadalnix.
3. You still can't do lookahead without extra checks
Once again, guys, have a look at lexer.c at the lines I pointed out.
More information about the Digitalmars-d
mailing list