Bug in users command
Norman Diamond
diamond at jit345.swstokyo.dec.com
Thu Jan 24 12:09:57 AEST 1991
In article <18981 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
>In article <6182:Jan2222:06:3991 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>>For comp.std.c readers: This argument started when I said that the BSD
>>users.c appears to be incorrect. It passes a two-dimensional character
>>array to qsort(), but the comparison function was expecting just a
>>pointer to characters. John says that's correct.
This is a tough one, and I don't dare to express an opinion yet.
But it's interesting to notice that certain well-known less careful
language lawyers also haven't answered this one yet.
>According to the standard, a pointer to a character or a pointer to
>a void is being passed.
Obviously. And the question is, are
char *a;
and
char (*b)[35];
required to have the same representation, or perhaps even be treated
as compatible.
>There is no mechanism in the standard to
>create a pointer to an arbitrary object,
This is false, though. This is why the preceding question exists.
Given
char c[35];
b and &c have the same type. (Most, if not all, pre-ANSI compilers
did not do this, but these are irrelevant.)
>or to find out the type of
>an object which has been passed to you.
This is true too, but irrelevant.
--
Norman Diamond diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list