Redigera

Dela via


Compiler Error C2036

'identifier' : unknown size

An operation on identifier requires the size of the data object, which cannot be determined.

Examples

The following sample generates C2036.

// C2036.c
// a C program
struct A* pA;
struct B { int i; } *pB;
int main() {
   pA++;   // C2036, size of A not known
   ((char*)pA)++;   // OK

   pB++;   // OK
}

The following sample generates C2036.

// C2036_2.cpp
// a C++ program
struct A* pA;
int main() {
   pA++;   // C2036, size of A not known
   ((char*&)pA)++;   // OK, if sizeof(A) == sizeof(char)
}