Subject: Re: 32/64 sign-extension bug in TCP
To: Chuck Silvers <chuq@chuq.com>
From: David Laight <david@l8s.co.uk>
List: tech-net
Date: 05/05/2004 21:03:28
> it's be really neat if there was a way to get the compiler (or lint) to
> treat different typedefs as incompatible types even if they map to the
> same underlying type. that way we could catch subtle bugs like a value
> in units of sectors is used in a context where the value is expect to have
> units of fs blocks. or it could catch confusion between vaddr_t and paddr_t.
> I haven't heard of anything that does that though.
Use pointers to structures instead of integers?
For instance, if you had:
typedef struct { char x; } *daddr_t;
Then 'daddr_t blockno;' has many of the properties of a strongly
typed integer.
David
--
David Laight: david@l8s.co.uk