On Thu, Aug 14, 2014 at 10:25:11AM +0100, Chris Wright wrote:

> > My personal opinion is that things like $a[$i++] = $i++ have zero practical
> > relevance (and also think that anyone using something like this deserves
> > any breakage he gets). I'd rather save some lines of code than maintain any
> > behavior guarantees for that. But some people have contrary opinions on
> > this, so I'm bringing up the point for discussion.
> 
> +1. It's documented as undefined behaviour, doing it in the first
> place is highly non-obvious to the reader with a clear ambiguity, it's
> fine by me to break from the current behaviour.

+1

It is OK to define some things as undefined and have them break between 
releases -
even minor releases. I always teach it as undefined - as it is in most
programming languages.

Likewise, if the next 2 characters on input are 'a' then 'b' what gets assigned
could either be 'ab' or 'ba':

    $TwoChars = fgetc($in) . fgetc($in);

Some code is just broken.

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT 
Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: 
http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to