[sane-devel] C undefined operations in sane-backends-1.0.7-beta1

Karsten Festag karsten.festag@t-online.de
Thu, 24 Jan 2002 08:12:53 +0100 (MET)


Hi,

I'll split
 bit = ++bit % 8;
in the two lines
 bit = ++bit;
 bit %= 8;

in microtek2.c

Henning, could you do this for me in CVS?

Thanks

Karsten

Tim Waugh schrieb:
> On Wed, Jan 23, 2002 at 09:43:35PM +0100, Henning 
> Meier-Geinitz wrote: 
> 
> > This is with gcc-3.x? I don't get them with gcc 2.95.4.
> 
> Yes.
> 
> > > They
> > > are for things like:
> > > 
> > > 	bit = ++bit % 8;
> > > 
> > > which are indeed undefined.
> > 
> > Because it's not clear if bit should be incremented and 
> then the right 
> > side assigned to it or vice versa? Or what's the excat 
> problem? 
> 
> Yes, that's right.  There is only one sequence point in 
> 'bit = ++bit % 
> 8;', at the end, and so the operations can happen in any 
> order.  There 
> are two assignments to 'bit': the '=' operation and the 
> '++' 
> operation.
> 
> Tim.
> */
> 
>