Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 1.44 KB

compiler-warning-c4958.md

File metadata and controls

53 lines (39 loc) · 1.44 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning C4958
Compiler Warning C4958
11/04/2016
C4958
C4958
e79b9e9c-d572-4a3a-a3b6-60962b70864a

Compiler Warning C4958

'operation' : pointer arithmetic is not verifiable

Remarks

Using pointer arithmetic will produce an unverifiable image.

For more information, see Pure and Verifiable Code (C++/CLI).

The /clr:safe compiler option is deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.

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

Example

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
}