Partager via


Compiler Warning (Level 1) C4567 (Windows Embedded CE 6.0)

1/5/2010

'function' : behavior change due to parameter 'parameter': calling convention incompatible with previous compiler versions

This warning indicates that the compiler encountered code that may not execute correctly if it is linked with code compiled by an earlier compiler version.

This warning is specific to the C++ compiler for the ARM(R) Architecture. Versions of the compiler older than 14.00 use a different calling convention than newer compilers when passing certain function parameters by value. The two calling conventions are not compatible, and linking object files from an older compiler with newer object files can result in unpredictable behavior and crashes if such a parameter is passed by value between the old and new object files.

An object of class, struct, or union type with a user-defined copy constructor is subject to this calling convention change if it is passed by value. Objects passed by reference are not affected.

If you are linking to object files from older compilers, use this warning to find places in your code where the calling convention has changed. If objects with user-defined copy constructors are passed by value between old and new object files, the old object files must be recompiled with a compiler version 14.00 or later.

This warning is off by default.

Example

// The following sample generates C4567:

// C4567.cpp
// (optional) compile with: -w14567
#pragma warning(default : 4567)
#pragma inline_depth(0) // disable function inlining

#include <cstdio>

struct S {
   S () { self = this; }
   S (S& that) { self = this; }
   ~S() {  // older compilers will fail this test
      if ( self != this ) {
         printf ("s passed incorrectly\n");
      }
   }
   S* self;
};

void func ( S s ) // C4567 at definition
{
   // s destructor is called here
}

int main()
{
   S s;
   func (s); // C4567 at call site
   return 0;
}

See Also

Reference

Device Compiler Error Messages

Other Resources

Differences Between Desktop and Device Compilers