- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
When we migrate our TBB from 2.1 to 3.0, we get unsuccessful compile errors. A lot of statements saying:
"Aligned data types not supported in managed code."
I just looked at TBB headers and it does use align for the atomic class:
#define __TBB_DECL_ATOMIC_FIELD(t,f,a) __declspec(align(a)) t f;
Used here:
template<>
struct atomic_rep<4> { // Specialization
#if _MSC_VER && __TBB_WORDSIZE==4
// Work-around that avoids spurious /Wp64 warnings
typedef intptr_t word;
#else
typedef int32_t word;
#endif
__TBB_DECL_ATOMIC_FIELD(int32_t,value,4)
};
The alignment isn't any more than the usual native alignment, but the compiler still complains. I don't know why TBB added the alignment. In TBB 2.1, the alignment was only used for 8 byte atomics. Now it is used for 2, 4, and 8 byte atomics.
So what is your suggestion to fix this?
Thanks,
Wallace
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If there is no immediate reason to not declare alignment, it is probably safest and easiest to declare alignment for all sizes, even if in a couple of years this might only be needed for 16-byte integers and up. And why should managed code not support alignment declarations if it would automatically provide such alignment anyway, so you might want to report this to Microsoft as well.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page