Re: [dwm] unsigned int or size_t

From: Filippo Erik Negroni <>
Date: Thu, 31 Jul 2008 10:03:29 +0100

2008/7/31 Szabolcs Nagy <>:
> On 7/31/08, Filippo Erik Negroni <> wrote:
> morale of the story:
> the c integer type system is not strong enough to add hints about
> which int is used in which context and how, or to write absolutely
> architecture independent code.
> the good news is:
> usually we don't want to do that (adding hints just makes the code
> less readable and applications has a very restricted audience eg. dwm
> doesn't want to be more portable than X)

My question was intentionally provocatory, and I agree with your answer.

I have used size_t in many contexts with ptrdiff_t, and I have
recently come to a similar conclusion.
In 'kelp', I play around with off_t and size_t a lot, and it has
started to give me headaches. My binary tree scan had to be ajdusted
several times to allow for size_t wraparound.

I have now decided to just check any 'input' arbitrary boundaries and
make sure they fit within the boundaries I have chosen.
I then make it possible for the user to redefine those boundaries via
#defines or typedefs if they think they ever need more.
It is an interesting problem because this inconsistency is part of the
standard in c99 and I am struggling to come to a conclusion as to why
this is the case.

Received on Thu Jul 31 2008 - 09:03:29 UTC

This archive was generated by hypermail 2.2.0 : Thu Jul 31 2008 - 09:12:03 UTC