Hi,

On Wed, 17 May 2006, Michael Hayes wrote:
> On Wed, 2006-05-17 at 16:55 +1200, Derek Smithies wrote:
> > 
> > constructs such as 
> >  b[i] = i++;
> 
> This is a good way to shoot yourself in the foot.  From memory a
> sequence point is not defined for the index, assignment, or increment
> operators in C (or C++) so the result of this operation is undefined.
> 
Ok,
so do you agree then that the programmer is better to take the above
construct, rework it as two lines, and let the optimiser do what
optimisers do really well, and the resultant code will be just as fast ?

What was that Kernighan quote,
 "if it takes all your ability to write some piece of code, and since 
debugging is harder than writing, then you are unable to debug the code"

given that quote, and the uncertainty of how the current (or other) 
compilers will interpret
   b[i] = i++;

surely this particular construct has to be reworked to two lines..

Derek.
-- 
Derek Smithies Ph.D.                 Any fool can write code that 
IndraNet Technologies Ltd.                a computer can understand.        
Email: [EMAIL PROTECTED]         Good programmers write code 
ph +64 3 365 6485                          that humans can understand.
Web: http://www.indranet-technologies.com/            Martin Fowler

Reply via email to