J
James
Here is a small program the demonstrates the problem I am having with a
certain compiler:
#include <stddef.h>
#include <stdio.h>
#define ALIGN_OF(t) \
offsetof(struct { char pad; t type; }, type)
int main(void)
{
printf("ALIGN_OF(short) == %lu\n", (unsigned long)ALIGN_OF(short));
return 0;
}
The code compiles fine on Comeau without any warnings:
http://www.comeaucomputing.com/tryitout
However, it fails to compile using EDG C99:
http://www.dinkumware.com/exam/default.aspx
I am getting the following errors:
--------------------
"sourceFile.c", line 9: error:
expected an expression
printf("short == %lu\n", (unsigned long)ALIGN_OF(short));
^
"sourceFile.c", line 9: error:
expected a ")"
printf("short == %lu\n", (unsigned long)ALIGN_OF(short));
^
2 errors detected in the compilation of "sourceFile.c".
--------------------
What am I doing wrong? Could it possibly be a compiler problem?
;^(
certain compiler:
#include <stddef.h>
#include <stdio.h>
#define ALIGN_OF(t) \
offsetof(struct { char pad; t type; }, type)
int main(void)
{
printf("ALIGN_OF(short) == %lu\n", (unsigned long)ALIGN_OF(short));
return 0;
}
The code compiles fine on Comeau without any warnings:
http://www.comeaucomputing.com/tryitout
However, it fails to compile using EDG C99:
http://www.dinkumware.com/exam/default.aspx
I am getting the following errors:
--------------------
"sourceFile.c", line 9: error:
expected an expression
printf("short == %lu\n", (unsigned long)ALIGN_OF(short));
^
"sourceFile.c", line 9: error:
expected a ")"
printf("short == %lu\n", (unsigned long)ALIGN_OF(short));
^
2 errors detected in the compilation of "sourceFile.c".
--------------------
What am I doing wrong? Could it possibly be a compiler problem?
;^(