httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <ma...@worldgate.com>
Subject Re: length types
Date Tue, 23 Dec 1997 15:24:17 GMT
On Tue, 23 Dec 1997, Alexei Kosut wrote:

> 
> > On the other hand, they aren't all present on all systems so using some
> > Apache-specific names makes it easier to "make it work" on all systems by
> > default.
> 
> Not really. Exhibit A:
> 
> #ifdef SOME_OLD_OS
> typedef signed long int apache_offset
> #elif defined(SOME_NEW_OS)
> typedef off_t apache_offset
> #endif
> 
> Exhibit B:
> 
> #ifdef SOME_OLD_OS
> typedef signed long int off_t
> #endif
> 
> The latter looks simpler and shorter to me.


Exhibit C:

#ifdef SOME_KNOWN_OLD_OS
typedef signed long int off_t
#elif defined(SOME_KNOWN_NEW_OS)
/* wow, done */
#else
#error hahaha.  you lose.  can't do a typedef for off_t because we don't
know if it already exists
#endif

Also consider the case where a system gets off_t at version 23.4.3.4.5
but not before.  If you do that, then the _ONLY_ way to do it is to 
use something that autoconfigures for it by trying it.  If you use a 
seperate type, you can be a bit conservative and still allow it 
to compile fine.  This has been a big in the past in similar issues.

> 
> -- Alexei Kosut <akosut@stanford.edu> <http://www.stanford.edu/~akosut/>
>    Stanford University, Class of 2001 * Apache <http://www.apache.org> *
> 
> 


Mime
View raw message