C1805: Non standard conversion used

[WARNING]

Description

An object pointer is cast to a function pointer or vice-versa - which is not allowed in ANSI-C. 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

  
  }