On 2013-03-01 07:12, Dmitry Olshansky wrote:
>> A 0 or a 0x1A is the end of valid D source. Period.
>> So I thought.
>> Well, I can't see the difference between 2 sentinel values: both 0 and
> 0x1A has to both work. For me that means both values have to be accepted
> as sentinels I'd call that a tuple of sentinels.
I think I understand how Walter things here. The D code always ends with '0' or '0x1A'. Regardless of what the end character is, DMD will always add an '0' to the end.
But you do need to check for both 0 and 0x1A.
--
/Jacob Carlborg

On 2013-03-01 00:23, Walter Bright wrote:
> Hmm, I hadn't thought of that. Some checking shows that VC and DMC do
> not do it, gcc and clang do.
Time for some new optimizations for DMC :)
--
/Jacob Carlborg

On Friday, 1 March 2013 at 07:02:51 UTC, Chris Nicholson-Sauls wrote:
> Which presupposes that I *can* use LDC (or GDC). For many people, it may not be an option. And last time I tried (which has been months now, admittedly) I couldn't get LDC to work for me at all, which is a shame since I'm actually very much interested in it. Either way, reliance on implementation details is not a good thing.
You don't rely on any implementation detail as the whole stuff will work with all implementation. It will simply not be able to take advantage of sentinel for speedup with some compilers. But the behavior will be exactly the same.
Different compilers produces executable of different efficiency. That isn't something new.

On Thu, 28 Feb 2013 17:00:06 -0500, Walter Bright <newshound2@digitalmars.com> wrote:
> On 2/28/2013 9:25 AM, Steven Schveighoffer wrote:
>> You have already stated it gets changed into a jump table.
>> Please, please listen to what I write. This is very frustrating. The code in lexer.c is there for all to see, and it amply illustrates everything I'm saying. For example, this code does not get translated into a jump table:
>> case '+':
> p++;
> if (*p == '=')
> { p++;
> t->value = TOKaddass;
> }
> else if (*p == '+')
> { p++;
> t->value = TOKplusplus;
> }
> else
> t->value = TOKadd;
> return;
I don't need to add any more to this discussion, it seems more qualified people are making the points I am making, but in a more understandable way.
Sorry to add to your frustration.
-Steve

On Thursday, 28 February 2013 at 22:00:11 UTC, Walter Bright wrote:
> On 2/28/2013 9:25 AM, Steven Schveighoffer wrote:
>> On Thu, 28 Feb 2013 12:00:48 -0500, Walter Bright <newshound2@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.
>> No, it is not. DMD is compiled with real compilers, not abstract "sufficiently smart compilers".
>
I finally decided to write a post about such imaginary "sufficiently smart compilers" that clearly don't exists today, never will and so we have to clutter the language : http://www.deadalnix.me/2013/03/23/a-story-about-optimization-llvm-and-the-sentinelinputrange/
I really hope that someone wrote this imaginary LLVM thing everybody is talking about !

On 3/24/13 7:32 AM, deadalnix wrote:
> I finally decided to write a post about such imaginary "sufficiently
> smart compilers" that clearly don't exists today, never will and so we
> have to clutter the language :
> http://www.deadalnix.me/2013/03/23/a-story-about-optimization-llvm-and-the-sentinelinputrange/>>> I really hope that someone wrote this imaginary LLVM thing everybody is
> talking about !
Looking great (also love the page design). The piece has a few systematic English language errors that should be easy to fix. Would you want to accept a copyedit step from a native speaker, and if so, is anyone here inclined to do that?
Thanks,
Andrei

On Sunday, 24 March 2013 at 11:49:17 UTC, Andrei Alexandrescu wrote:
> On 3/24/13 7:32 AM, deadalnix wrote:
>> I finally decided to write a post about such imaginary "sufficiently
>> smart compilers" that clearly don't exists today, never will and so we
>> have to clutter the language :
>> http://www.deadalnix.me/2013/03/23/a-story-about-optimization-llvm-and-the-sentinelinputrange/>>>>>> I really hope that someone wrote this imaginary LLVM thing everybody is
>> talking about !
>> Looking great (also love the page design). The piece has a few systematic English language errors that should be easy to fix. Would you want to accept a copyedit step from a native speaker, and if so, is anyone here inclined to do that?
>
I'd be happy to, if someone want to do it.