Subject: Re: Bug in regex library?
To: None <Marc.Baudoin@hsc.fr, seebs@solon.com>
From: der Mouse <mouse@Holo.Rodents.Montreal.QC.CA>
List: current-users
Date: 10/29/1996 18:43:31
> A side note; the reason this bites you is that we use "long long",
> which is an explicit violation of the C standard.

Well...the reason it bites you is that our off_t, and therefore
regoff_t, are larger than long ints.  Yes, "long long int" is not legal
C, and yes, "long long int" is the underlying type in our
implementation.  But neither of these is, strictly, relevant to the
problem.

Nobody has convinced me that it is a violation of the standard to have
a type longer than a long, nor even for off_t to be such a type;
indeed, I don't think I've seen even unsupported claims to that effect.
And that's really all it takes to break that code, for regoff_t to be a
type that doesn't promote to "the same thing" as long int, under the
default promotion rules.

> Why do we do this?  Because a lot of old code depends on "long" not
> being that large, and on it being a native (thus efficient) type.

True.  Also, strictly, if you want to store numbers outside the
0..65535 range (unsigned) or -32767..32767 [$] range (signed), you have
to use long anyway.  Or else litter your code with conditionals on
INT_MIN and INT_MAX (for example), which _nobody_ does, at least in my
experience.  Therefore, long really should be an efficient type.

[$] I think that's the right range; it's certainly within plus-or-minus
    two of right.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     01 EE 31 F6 BB 0C 34 36  00 F3 7C 5A C1 A0 67 1D