Re: fun with ?:

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 23, 2007 at 11:25:44PM +0900, Neil Booth wrote:
> I respect you too much Al to doubt you, but I do warn you that
> getting the rules for integer constant expressions right in C is
> harder than it looks.  GCC is not very close.  The immediate
> cast of float bit painful in recursive descent parsers.  I've managed
> to find cases where Comeau's online compiler doesn't get it right,
> and they're pretty good.
> 
> I have a test suite that tests these things to an unhealthy level of
> pedantry for my own implementation (the only one I know passes the lot,
> of course 8-); happy to run sparse when you've finished if you like.

gcc integer constant expressions handling is a bad joke.

extern int n;
struct {
	int x : 1 + n - n;
} y;

passes with -pedantic -std=c99.  Replacing that with 1 + n - n + n - n
is still OK with gcc; 1 + n + n - n - n is not.

So that's hardly an example of, well, anything.
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux