C1805: Non standard conversion used

[DISABLE, INFORMATION, WARNING , ERROR]

Description

In ANSI-C it is normally not allowed to cast an object pointer to a function pointer or a function pointer to an object pointer. Note that the layout of a function pointer may not be the same than the layout of a object pointer.

Example
  typedef unsigned char (*CmdPtrType) 

  
          (unsigned char, unsigned char);

  
  typedef struct STR {int a;} baseSTR;

  
  baseSTR strDescriptor;

  
  CmdPtrType myPtr;

  
  // next line does not strictly correspond to ANSI C

  
  //   but we make sure that the correct cast is being used

  
  void foo(void) {

  
    myPtr=(CmdPtrType)(void*)&strDescriptor; // 
  message C1805

  
  }

  
  */

  
  /*! \page pageC1806 C1806: Illegal cast-operation

  
  [ERROR]

  

Description

There is no conversion for doing the desired cast.

Tips

The cast operator must specify a type, that can be converted to the type, which the expression containing the cast operator would be converted to.