Re: a nifty feature for c preprocessor

2011-12-31 Thread Robert Dewar
On 12/31/2011 4:44 AM, R A wrote: alright, here's another example why eval is a good idea: #define A 17 #define B 153 #define N1 ((A + B)/2) /* intended was (17 + 153)/2 */ #undef A #define A 230 #define N2 ((A + B)/2) /* intended was (230 + 15

Bogus gcc.c-torture/execute/20071018-1.c testcase?

2011-12-31 Thread Mark Kettenis
Execution of the test randomly fails for me on OpenBSD/amd64. Looking at the code, it seems it is doing an out-of-bounds array access. For refernce I've copied the code of the testcase below. As you can see there's a foo(0) call in main(). Therefore struct foo **upper = &as->x[rank * 8 - 1];

RE: a nifty feature for c preprocessor

2011-12-31 Thread R A
alright, here's another example why eval is a good idea: #define A 17 #define B 153 #define N1 ((A + B)/2) /* intended was (17 + 153)/2 */ #undef A #define A 230 #define N2 ((A + B)/2) /* intended was (230 + 153)/2 */ printf("%u %u", N1, N2);