[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] data type "int" and article numbers in leafnode - portability?



* Cornelius Krasel (krasel@xxxxxxxxxxxxxxxxxxxxxxxxxxxx) [1999-07-21 09:02]:
> Matthias Andree wrote:
> 
> > after hacking a little in leafnode (I hope, the world is already
> > appreciating some of the bug fixes I contributed), I am wondering which
> > part of the entire package guarantees that an int is actually at least
> > 32 bits wide. Since all article numbers are stored in a simple "int"
> > type variable, I expect leafnode to break down horribly in case
> > somebody uses it on a system that uses 16 bit "int".
> 
> Yup. The proper solution would be to replace all ints by unsigned longs.

Hum. Well. Sort of, since some functions have special types like time_t
- that's not always reflected in the source, there's sometimes an int
where a time_t would be appropriate. 

> I think Kazushi has done this in leafnode+. I suppose it will be a major
> hassle, though :-)

I tried it a little in leafnode 1.9.4 and experienced that it is a
giant hassle, regretfully, plus in some places, there are hidden
troubles. I don't claim my changes were proper, but I gave up when I
saw log entries like these:

Jul 20 19:03:19 emma1 fetchnews[22002]: skipping articles
1662-4294964956 inclusive (article limit)

It would require a more careful rewriting of major parts of the code,
so I suggest considering putting these three lines into leafnode.h:

#if ~0u < 0xfffffffflu
#error "leafnode does not compile with int less than 32 bits"
#endif

So we don't run into troubles on short-int setups. 

-- 
Matthias Andree

 Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list