A Bug By Any Other Name ...

Rhodri James rhodri at wildebst.demon.co.uk
Mon Jul 6 19:23:57 EDT 2009


On Mon, 06 Jul 2009 17:54:35 +0100, Dave Angel <davea at ieee.org> wrote:

> Rhodri James wrote:
>> Indeed, arguably it's a bug for C compilers to fail to find the valid
>> parsing of "++5" as "+(+5)".  All I can say is that I've never even
>> accidentally typed that in twenty years of C programming.
>>
> But the C language specifically defines the tokenizer as doing a  
> max-match, finding the longest legal token at any point.  That's how  
> many things that would otherwise be ambiguous are well-defined.  For  
> example, if you want to divide two integers, given pointers to them, you  
> need a space between the slash and the start.
>          *p1/*p2    begins a comment,  while   *p1/ *p2   does a division

You know, I've never had that come up either!  My habit of sticking spaces
around binary operators purely for legibility probably helped, but I'm
still a bit boggled.

-- 
Rhodri James *-* Wildebeest Herder to the Masses



More information about the Python-list mailing list