Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Compiler Warning C4958
Collapse the table of content
Expand the table of content

Compiler Warning C4958

Error Message

'operation' : pointer arithmetic is not verifiable

Using pointer arithmetic will produce an unverifiable image.

For more information, see Pure and Verifiable Code.

This warning is issued as an error and can be disabled with the warning pragma or the /wd compiler option.

The following sample generates C4958:

// C4958.cpp
// compile with: /clr:safe
// #pragma warning( disable : 4958 )
using namespace System;

int main( ) {
   Int32 arr[] = new Int32[10];
   Int32* p = &arr[0];
   p++;   // C4958
}

The compiler implements array operations with pointer arithmetic. Therefore, native arrays are not verifiable; use a CLR array instead. For more information, see array.

The following sample generates C4958:

// C4958b.cpp
// compile with: /clr:safe
// #pragma warning( disable : 4958 )

int main() {
   int array[5];
   array[4] = 0;   // C4958
}

Community Additions

ADD
Show:
© 2015 Microsoft