NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2446

'operator' : no conversion from 'type1' to 'type2'

The compiler cannot convert type1 to type2. The conversion may not make sense because it violates C/C++ semantics.

If you encounter this error on code that was compiled with an earlier version of Visual C++, see Technote: Improved Conformance to ANSI C++.

Example

The following code has two conversion problems:

  1. Converting an int to a pointer to char has no meaning.
  2. Converting a pointer to a const object into a pointer to a non-const object is not allowed, since it would enable you to modify the const object, violating the semantics of const.
    int i;
    char *p;
    int *j;
    const int *cj;
    
    void main()
    {
       p = i;  // ERROR #1: conversion has no meaning
       j = cj; // ERROR #2: pointer to const obj
    }