portability patch for kaffeh

Michael R Cook mcook at cognex.com
Sat May 3 17:22:47 PDT 1997


In an expression like `x = f() | g()' compilers are not constrained
to evaluate f() before evaluating g().  (In fact, the same compiler
might do the evaluation differently depending on, say, the selected
level of optimization.)

*** kaffe/kaffeh/file.h.~1~	Wed Apr 16 04:10:53 1997
--- kaffe/kaffeh/file.h	Sat May  3 20:17:15 1997
***************
*** 13,20 ****
  #ifndef __file_h
  #define __file_h
  
! #define	readu1(c, f)	(*(c)) = getc(f)
! #define	readu2(c, f)	(*(c)) = (getc(f) << 8) | getc(f)
! #define	readu4(c, f)	(*(c)) = (getc(f) << 24)|(getc(f) << 16)|(getc(f) << 8)|getc(f)
  
  #endif
--- 13,20 ----
  #ifndef __file_h
  #define __file_h
  
! #define	readu1(c, f)	((*(c)) = getc(f))
! #define	readu2(c, f)	((*(c)) = getc(f) << 8, (*c) |= getc(f))
! #define	readu4(c, f)	((*(c)) = getc(f) << 24, (*c) |= getc(f) << 16, (*c) |= getc(f) << 8, (*c) |= getc(f))
  
  #endif

Michael.

--UAB05067.862705390/yorktown.cognex.com--



More information about the kaffe mailing list