Export (0) Print
Expand All
Expand Minimize

Compiler Error C3839

cannot change alignment in a managed type

Alignment of variables is controlled by the common language runtime and cannot be modified with align.

The following sample generates C3839:

// C3839a.cpp
// compile with: /clr
ref class C
{
public:
   __declspec(align(32)) int m_j; // C3839
};

int main()
{
}

The following sample generates C3839:

// C3839b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>

__gc class C
{
public:
   __declspec(align(32)) int m_j; // C3839
};

int main()
{
}

Community Additions

ADD
Show:
© 2014 Microsoft