Re: struct stat

Ben Pfaff (pfaffben@pilot.msu.edu)
11 Mar 1999 17:35:46 -0500


alan@lxorguk.ukuu.org.uk (Alan Cox) writes:

> Our problem, though, I think is somewhat different. When we
> use lcc to compile, say, the Spec95 benchmark suite, it emits
> compile-time errors in the builds of gcc and perl. These
> two benchmarks compare st_dev for equality, and we all know
> that it is illegal in C to compare two structs.

I was under the impression ANSI C mandated a bytewise comparison.

ANSI 6.3.9 says that the operands to == and != must be one of the
following (paraphrasing, somewhat simplified):
- both of arithmetic type
- both pointers to compatible types
- one any type of pointer and the other a pointer to void
- one a pointer and the other a null pointer constant
i.e., structs aren't allowed.

On the other hand, I don't see the gcc documentation listing
comparison of structs as one of its extensions.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/