Share via


Compiler Migration Issues (Windows CE 5.0)

Send Feedback

The following list describes how to work with some issues that may arise in migrating from previous versions of Windows CE compilers to Windows CE 5.0 compilers.

  1. The new compiler includes the _FUNCTION_ predefined macro. For backward compatible code, add the following definition:

    #if _MSC_VER < 1300
    
    #define __FUNCTION__ ""
    
    #endif
    

    If not defined as above you will get the following error:

    error C4117: macro name '__FUNCTION__' is reserved, '#define' ignored
    

    For more information, see Predefined Macros.

  2. Template function resolution is different than before. In most cases, this change does not affect existing code because the affected code would not have compiled before. However, the implementation of HashKey has changed.

    The following example shows the way this difference can impact existing code.

    template<class T>
    DWORD HashKey(const T &t)
    {
                // General implementation of HashKey for all types
    }
    
    DWORD HashKey(const MyType &t)
    {
                // Specialized implementation of HashKey for MyType
    } 
    

    In earlier compilers, the specialized implementation of HashKey will be used as expected.

    In 7.1 or later compilers, template and nontemplate functions are in separate namespaces, so HashKey(const MyType &) is not considered a specialization of template<class T> HashKey(const T&).

    Instead, the new compilers use the general implementation of HashKey.

    To fix this, define a template specialization, as shown in this example code:

    template<>
    DWORD HashKey(const MyType &t)
    {
                // Specialized implementation of HashKey for MyType
    }
    
  3. For compilers earlier than 7.1, a common method of hiding function calls with empty statements was with #define function 0. The new versions of the compiler, _MSC_VER==1310, do not accept because it is not c++ conformant.

    Use the __noop keyword, introduced where _MSC_VER==1201 instead.

See Also

About Supported Microprocessors | ARM Technology Guide | Renesas Technology Guide | MIPS Technology Guide

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.