Hello,
I found a discrepancy in the sizeof operator in nvcc. If I compile the following program (test.cpp) using nvcc and g++ I get different results:
[codebox]
#include <stdio.h>
typedef struct {
unsigned int r, g, b;
} RGB32 attribute ((aligned (16)));
int main(void)
{
printf("Size of RGB32 is %d\n", (int)sizeof(RGB32));
return 0;
}
[/codebox]
$ g++ test.cpp
$ ./a.out
Size of RBG32 is 12
$ cp test.cpp test.cu
$ nvcc test.cu
$ ./a.out
Size of RBG32 is 16
I am using nvcc 2.3, g++ 4.3, and Ubuntu 9.10 (Linux 2.6.31 x86_64).
I was wondering if anyone had seen this before. I haven’t had a chance to upgrade nvcc to 3.0 but I doubt the result will be different.
Thank you,
Rodrigo