Closed GoogleCodeExporter closed 8 years ago
What is the expected result and where does this error occur in the code?
Original comment by Mj.Marcu...@gmail.com
on 15 Dec 2010 at 10:01
THE CORRECT FORM IS:
//-----------------------------------------------------
#define SIZE 200
typedef struct TestStruct TestStruct;
struct TestStruct
{
int b;
};
TestStruct **structs = (TestStruct**)malloc( sizeof(TestStruct*) * SIZE );
// SET ALL NULL
for(int i=0;i<SIZE;i++)
structs[i] = NULL;
for(int i=0;i<SIZE;i++)
{
structs[i] = malloc( sizeof(TestStruct) );
structs[i].b = 1;
}
//-----------------------------------------------------
gokernel
gokernel@hotmail.com
Original comment by goker...@gmail.com
on 16 Dec 2010 at 12:52
This seems to be a bug in expression parsing. The [] and . operators have equal
operator precedence. This is leading to right-to-left evaluation by default,
which is incorrect - it should be left-to-right for these operators.
I'm still thinking about how to fix this.
Original comment by zik.sale...@gmail.com
on 7 Jan 2011 at 4:29
Turns out it was because the expression stack wasn't being collapsed on a
closing square bracket.
Original comment by zik.sale...@gmail.com
on 14 Feb 2011 at 4:05
Fixed in revision r520
Original comment by zik.sale...@gmail.com
on 14 Feb 2011 at 6:06
Verified
Original comment by zik.sale...@gmail.com
on 14 Feb 2011 at 6:06
Original issue reported on code.google.com by
demonmit...@rambler.ru
on 13 Aug 2010 at 7:37