httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@leland.Stanford.EDU>
Subject Re: length types
Date Tue, 23 Dec 1997 08:30:17 GMT
On Tue, 23 Dec 1997, Marc Slemko wrote:

> Would we perhaps be wise to use our own type names?  This doesn't avoid
> the decision of what to make them, it just takes a step back and reminds
> us what they are for.  Not sure there is any point in this.

That seems silly.

> Do we want to use off_t for everything?  That would be a bastardization
> because off_t is for file sizes.

Why would we want to do that? off_t is for file offsets. What I'm saying
is that there are a whole bunch of types - I know size_t is ANSI, I'm not
sure about the rest - that are designed for use as specific forms of
numbers - file lengths, string lengths, offsets, etc..., that are part of
the OS, and we might want to make an effort to use them.

> size_t is for "sizes of objects", which is reasonable for many things, but
> not files.  We may be well served to look closely at the standards (Single
> Unix Spec is a good reference simply because it is available free online); 
> to be really correct, we can not have a generic type.  It may be worth
> making the effort to use the several standard *_t types properly. 

Um... yeah. You just restated my original email, albiet in a much
longer and more detailed fashion. So what's the answer?

> 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.

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



Mime
View raw message