<div class="gmail_quote">On Thu, Aug 4, 2011 at 9:43 AM, Charles Manning <span dir="ltr"><<a href="mailto:manningc2@actrix.gen.nz">manningc2@actrix.gen.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On Thursday 04 August 2011 08:53:48 Andre Renaud wrote:<br>
> On 03/08/11 22:13, Volker Kuhlmann wrote:<br>
> > On Wed 03 Aug 2011 11:40:03 NZST +1200, Charles Manning wrote:<br>
> >> In my books there is also a very hot place reserved for those who write<br>
> >> things like<br>
> >> while((*x++ = *y++)){}<br>
> ><br>
> > You can't really compare this with previous examples. This one is much<br>
> > different because it is undefined, unpredictable and therefore useless<br>
> > and much worse. Your choc fish challenge was defined in its behaviour<br>
> > and predictable, although extremely bad programming and a convoluted way<br>
> > to say while(1); .<br>
><br>
> I don't think this is undefined - isn't this a simple implementation of<br>
> strcpy (assuming x & y are char *)? It will continue around until it<br>
> assigns a 0 pointer, at which point it will stop. It would be undefined<br>
> if you had *x++ = *x++.<br>
><br>
<br>
Exactly my reason why this is a bad code.<br>
<br>
The algorithm is hidden and non obvious.<br>
<br>
I'd far rather someone wrote:<br>
<br>
while((*x = *y)) {<br>
x++;<br>
y++;<br>
}<br>
<br>
</blockquote><div>I agree.<br><br>Expert coders can produce functional write only code, professionals including the open source community should produce maintainable code.<br><br>Use the source code show the intent. Let the compiler do the optimisation.<br>
<br>If this was off topic, it certainly generated plenty of interest!<br><br>Richard<br></div></div>