[chbot] !!!!!!!! Choc fish challenge 2 !!!!!!!!!

Andre Renaud andre at bluewatersys.com
Wed Aug 3 21:53:48 BST 2011


On 03/08/11 22:13, Volker Kuhlmann wrote:
> On Wed 03 Aug 2011 11:40:03 NZST +1200, Charles Manning wrote:
> 
>> In my books there is also a very hot place reserved for those who write things 
>> like 
>> while((*x++ = *y++)){}
> 
> You can't really compare this with previous examples. This one is much
> different because it is undefined, unpredictable and therefore useless
> and much worse. Your choc fish challenge was defined in its behaviour
> and predictable, although extremely bad programming and a convoluted way
> to say while(1); .

I don't think this is undefined - isn't this a simple implementation of
strcpy (assuming x & y are char *)? It will continue around until it
assigns a 0 pointer, at which point it will stop. It would be undefined
if you had *x++ = *x++.

Regards,
Andre



More information about the Chchrobotics mailing list