Megosztás a következőn keresztül:


Compilers for Smart Device Projects

Visual Studio includes the following compilers that target microprocessors used in smart devices:

  • 32-bit C/C++ compiler used to compile and link 32-bit ARM C, and C++ programs.

  • 32-bit C/C++ compiler used to compile and link 32-bit Renesas SH-4 C, and C++ programs.

  • A C/C++ compiler used to compile and link MIPS16, MIPS32, MIPS64 C, and C++ programs.

The compilers produce Common Object File Format object files. The compiler programs compile each source file and, unless otherwise specified, an object file for each compile. The compilers include the options listed at the command line (CL), in the CL environment variable, and any specified response files.

Visual Studio Compiler Differences Between Desktop and Devices

Difference

Description

Advanced Tab, Compile for Architecture drop-down list.

Device projects in Project Properties, Advanced tab , Compile for Architecture list, under C/C++ node, have the following options in the drop down box: Arm4 (/QRarch4), ARM5 (/QRarch5), Arm4t (/QRarch4t), ARM5t (/QRarch5t).

Advanced Tab, Interwork ARM & ARM Thumb drop-down list.

Device projects in Project Properties, Advanced tab , Interwork ARM & ARM Thumb list under C/C++ node, have the following options in the drop down box: Yes (/QRInterwork-return), and NO option. When set to yes, the compiler generates thunking code to interwork ARM 16 and 32 bit code.

Advanced Tab, Enable Floating Point Emulation drop-down list.

Device projects in Project Properties, Advanced tab, Enable Floating Point Emulation drop-down list under C/C++ node, have the following options in the drop down box: Yes, and NO option. When set to Yes, the compiler enables emulation of floating point operations.

PreProcessor Tab, PreProcessorDefinitions input box.

Device projects in Project Properties, PreProcessor tab, PreProcessorDefinitions input box, under C/C++ node, have a check box to Inherit From Parent or Project Defaults and a Macros button to add macros.

Optimization Tab, Floating Point ConsistencyDefinitions drop-down list.

Device projects in Project Properties, Optimization tab, Floating Point ConsistencyDefinitions drop-down list, under C/C++ node, have a drop-down list to select Default Consistency or Improve Consistency (/Op).

For additional information see Compiler Options Listed Alphabetically.

Changes from Previous Versions of Visual Studio

Compiler Changes Between Visual Studio 2003 and Visual Studio 2005

Because the device compilers are based on the desktop computer Visual C++ compiler, examining the differences between versions of the desktop compilers provides a good picture of the changes between the eMbedded Visual C++ device compilers and the Visual Studio 2005 device compilers. For information about changes between Visual Studio 6.0 and Visual Studio 2003, see Compatibility and Compliance Issues in Visual C++.

The following table summarizes compiler changes between Visual Studio 2003 and Visual Studio 2005.

Issue

Description

Pointer-to-members now require qualified name, address-of operator (&), and parenthesis in function calls.

Code that was written for earlier versions of the compiler that used only the method name will now give Compiler Error C3867 or Compiler Warning C4867. This diagnostic is required by the ISO C++ standard. To create a pointer to a member function, the address-of operator (&) and the fully qualified name of the method must be used. Errors may result from not requiring the & operator and the fully qualified name of the method, or because of missing parentheses in function calls. Using the function's name without an argument list causes a function pointer that is convertible to several types. Therefore, the code may produce unexpected behavior at run time.

A class must be accessible to a friend declaration.

Previous Visual C++ compilers enabled a friend declaration to a class that was not accessible in the scope of the class that contained the declaration. In Visual C++ 2005, these circumstances will cause the compiler to generate Compiler Error C2248. To resolve this error, change the accessibility of the class that is specified in the friend declaration. This change was made to comply with the ISO C++ standard.

Explicit specialization is not allowed as a copy constructor and copy assignment operator.

Code that depends on an explicit template specialization for a copy constructor or copy assignment operator will now generate Compiler Error C2299. The ISO C++ standard does not allow this usage. This change was made for conformance reasons, to improve code portability.

An unspecialized class template cannot be used as a template argument in a base class list.

Using an unspecialized template class name in the base class list for a class definition will cause Compiler Error C3203. It is invalid to use an unspecialized template class name as a template parameter in a base class list. You must explicitly add the template type parameters to the template class name when you use it as a template parameter in a base class list. This change was made for conformance reasons and to improve code portability.

A using declaration of nested type is no longer allowed.

Code that has a using declaration to a nested type will now generate Compiler Error C2885. To resolve this error, you must fully qualify references to nested types, put the type in a namespace, or create a typedef. This change was made for conformance reasons, to improve code portability.

/YX compiler option is removed.

The /YX compiler option generated automatic precompiled headers support. It was used by default from the development environment. If you remove the /YXcompiler option from your build configurations, it can produce faster builds. In addition to performance issues, the /YX compiler option introduces the chance of unexpected run time behavior. It is better to use /Yc, Create Precompiled Header File, and /Yu,Use Precompiled Header File, which give you more control over how precompiled headers are used.

/Oa and /Ow compiler options are removed.

The /Oa and /Ow compiler options have been removed and will be ignored. Use the noalias or restrictdeclspec modifiers to specify how the compiler does aliasing.

/Op compiler option is removed.

The /Opcompiler option has been removed. You can use /fp:precise instead.

/ML and /MLdcompiler options have been removed.

Visual C++ 2005 no longer provides single-threaded, statically linked CRT library support. You can use /MT and /MTd instead.

/G3, /G4, /G5, /G6, /G7, and /GBcompiler options have been removed/

The compiler now uses a blended model that tries to create the best output file for all architectures.

/Gf compiler option has been removed.

You can use /GF instead. /GF puts pooled strings into a read-only section, which is safer than the writeable section where /Gf added them.

/GS compiler option is now on by default.

Buffer overflow checking is now on by default. You can turn buffer overrun checking off with /GS-.

/Zc:wchar_t variable is now on by default.

This is ISO C++ standard behavior: A wchar_t variable will default to the built-in type instead of a short unsigned integer. This change will break binary compatibility when the client code is linked with libraries that were compiled without /Zc:wchar_t. You can use /Zc:wchar_t- to revert to the old, non-standard behavior. This change was introduced to create conformant code by default.

/Zc:forScope variable is now on by default.

This is ISO C++ standard behavior: Code that depends on the use of a variable declared in a for loop after the for loop scope has ended will not now compile. You can use /Zc:forScope to revert to the old, non-standard behavior. This change was introduced to create conformant code by default.

Enforce parameter checking for Visual C++ attributes.

Code that passes named attributes to the attribute constructor in quotation marks when the type is not a string, and without quotation marks when the type is a string, will now generate Compiler Error C2065 or Compiler Warning (level 1) C4581. Previously, all compiler attributes were parsed as strings, and if it is necessary, the compiler inserted the missing quotation marks. Attribute support was enhanced by adding parameter checking validation. This change will prevent unexpected behavior because of incorrect arguments being passed to an attribute constructor.

Compiler will not inject type int as the default type in declarations.

Code that is missing the type in a declaration will no longer default to type int. The compiler will generate Compiler Warning C4430 or Compiler Warning (level 4) C4431. The ISO C++ standard does not support a default int, and this change will help ensure that you get the type you explicitly specified.

For more information, see Breaking Changes in the Visual C++ 2005 Compiler.

See Also

Other Resources

Developing Visual C++ Device Projects