Mailinglist Archive: opensuse-programming (31 mails)

< Previous Next >
Re: [opensuse-programming] What's the best way to cure uninitialized variables?
  • From: Philipp Thomas <Philipp.Thomas2@xxxxxxx>
  • Date: Sat, 08 Aug 2009 16:30:29 +0200
  • Message-id: <sr1r759nittor5fq7r7nl6is3vdver8o8e@xxxxxxx>
On Sat, 08 Aug 2009 15:58:59 +0200, you wrote:

Line 1836 = *poly_index_pt++ = *poly_index_pt++ = index[i];
Line 1783 = *poly_index_pt++ = *poly_index_pt++ = index[i];

I will revert back to the original.

no need for that :) AFAICT you just need to change both lines to

*poly_index_pt = *(poly_index_pt+1) = index[i];
*poly_index_pt += 2;

The compiler correctly complains because the outcome of the original
operation is undefined as the compiler is free to choose the order in
which to execute them as there are no sequence points which would
order the operations. Therefore the programmer has to split such
operations in a way that forces the compiler to do the operations
exactly in the sequence the programmer had in mind.

I've encountered such code more often then I would like but only after
GCC began to complain about it.

To unsubscribe, e-mail: opensuse-programming+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-programming+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups