hankgao0703 (Programmer) Aug 20, 2002
In one of my projects, I have to use __declspec(align(16) to force the memory allocation is done at 16 bytes boundary, but I alway get error:
C1306(or else) => Unsupported Data Type
When I remove __declspec(align(16)) modifier, everything seems ok.
by the way, based on the MS document, __declspec(align(xx)) is used to specify boundary for structure, Can I use it for memory allocation for an array?
Thanks in advance!
==============================================
sflam (Programmer) Aug 20, 2002
Can you show your code?
Shyan
==============================================
hankgao0703 (Programmer) Aug 21, 2002
Sure,
I declare a structure type as the following:
__declspec(align(16))
struct MyStruct {
//
short shortArray[12][64];
.....
}myVarName;
and the compiler reports:
fatal error C1600: unsupported data type
When I doule clike this error message in the build window, I can go nowhere in the sourcecode.
It takes me quite a while to figure out the reason is the __declspec(align(16)) modifier.
==============================================
sflam (Programmer) Aug 21, 2002
I don't have problem with the code fragment of yours. What kind of project are you trying to build?
The doc for C1600 said it could due to "imcomplete installation". May be you should reinstall VC.NET.
Sorry if this is not helpful.
Shyan
==============================================
hankgao0703 (Programmer) Aug 22, 2002
"Incomplete installation"? probably, I never thought of this reason, and I will check it out.
I don't quite understand why you say VC.NET, I am using VC6.00, Do I have to use VC.NET before I can use __declspec(align(xx))?
==============================================
sflam (Programmer) Aug 22, 2002
Something is not right here...Don't reinstall your installation yet.
__declspec() do not support align() in VC6. It only works on VC.NET.
in VC6, you have to use #pragma pack(16), or its variations:
// Save current alignment setting to interanl compiler stack and
// set alignment setting to 16
#pragma pack(push, 16)
// ...
// put your struct here
// ...
// Restore previous alignemnt setting
#pragma pack(pop)
HTH
Shyan
==============================================
hankgao0703 (Programmer) Aug 22, 2002
Thanks, this is of great help