AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
September 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2007.09.12 03:36 "SIZEOF_UNSIGNED_LONG", by Frank Warmerdam
2007.09.12 12:59 "Re: SIZEOF_UNSIGNED_LONG", by Edward Lam
2007.09.12 13:04 "Re: SIZEOF_UNSIGNED_LONG", by Edward Lam
2007.09.12 13:56 "Re: SIZEOF_UNSIGNED_LONG", by Frank Warmerdam
2007.09.12 14:09 "Re: SIZEOF_UNSIGNED_LONG", by Edward Lam
2007.09.12 15:01 "Re: SIZEOF_UNSIGNED_LONG", by Frank Warmerdam
2007.09.12 15:09 "Re: SIZEOF_UNSIGNED_LONG", by Edward Lam
2007.09.12 15:02 "Re: SIZEOF_UNSIGNED_LONG", by Bob Friesenhahn

2007.09.12 14:09 "Re: SIZEOF_UNSIGNED_LONG", by Edward Lam

Frank Warmerdam wrote:
> Well, this doesn't address the case of it being defined to
> something odd, like 5.  

And why is that a problem? What if my platform does indeed have 
sizeof(long) == 5? or sizeof(long)==16?

If you're concerned about this, then I think runtime checking is the 
only real way to do. It should hardly be an efficiency issue if someone 
like TIFFClientOpen() checked SIZEOF_UNSIGNED_LONG with sizeof(unsigned 
long) and error out if they don't match.

-Edward

> #if SIZEOF_UNSIGNED_LONG == 8
> ... code
> 
> #elif SIZEOF_UNSIGNED_LONG == 4
> ... code
> 
> #else
> #error "SIZEOF_UNSIGNED_LONG undefined or defined to a value other than 
> 4 or 8"
> #endif
> 
>>> Er, what happened to the SIZEOF_LONG macro? I'm still using 3.7.0 
>>> though.
> 
> I believe that this bit of code was touched as part of libtiff 4 work and
> was altered to use unsigned long and the required macro was accordingly
> changed.  I might question the necessity of the change, but for now I'm
> happy to make this arrangement more bullet proof.  SIZEOF_LONG may still
> be used in other parts of the code base.
> 
> Best regards,