Microsoft Visual Studio C ++ compiler option settings

Source: Internet
Author: User
1. The optimization options of VC-> Project-> setting-> C/C ++ depend on and category drop-down box:

  • General
Provides the most effective method to select a general optimization goal, but does not allow fine-grained control of a single optimization technology. There are five options under the optimization option: Default, disable (Debug), maximize speed, minimize size, and customize. Disable disables all optimization options. You can use default when the compiler needs to execute some faster code optimizations of concern and clear all other optimizations, including disable. The customize optimization option provides manual control over function-level connections and character string dummy offline. Maximize speed and minimum size settings of General Category
Optimization Options Maximize speed Minimum seize
Generate internal function inline None
Quick code optimization None
Minimum code optimization None
Global Optimization Enabled
Ignore frame pointer
Stack check disabled
Enable character string offline
Function-level link enabled
  • Code Generation
Select processor optimization and default call specifications for a project. Codegeneration includes the user's current optimization options for special processors, the default call rules, the runtime class libraries used by the application, and the methods for using the member structure. Select processor to indicate Compiler Optimization. By default, blend indicates a compromise. Select the call specification visual c ++ to allow three call specifications: __cdecl, _ fastcall, and _ stdcall. The call specification determines the parameter transfer from left to right or from right to left. Who is responsible for clearing the stack and explaining the function name.
Call Specification Transfer Order Stack clearing performer Interpretation Style
_ Cdecl From right to left Caller _ Functionname
_ Fastcall From right to left Called Program @ Functionname @ NNN
_ Stdcall From right to left Called Program _ Functionname @ NNN
Nnn ---- indicates the number of bytes in the parameter list (1) _ stdcall call _ stdcall is the default call method of the PASCAL program. The parameter uses the stack pressure mode from right to left, the called function clears the stack before returning. Win32 APIs all use the _ stdcall call method. This macro definition illustrates the problem: # define winapi _ stdcall is compiled in C mode, where the _ stdcall call convention underscores the name of the output function, add the "@" symbol and the number of bytes of the parameter, for example, _ functionname @ NNN. (2) _ cdecl call _ cdecl is the default call Method for C/C ++. The parameter uses the stack pressure mode from right to left, the memory stack of the transfer parameter is maintained by the caller. _ Functions agreed by cedcl can only be called by C/C ++. Each function that calls it contains code for clearing the stack, therefore, the size of the executable file is larger than that of the _ stdcall function. Since the parameter memory stack of the _ cdecl call method is maintained by the caller, the variable-length parameter function can (or can only) use this call convention. Because visual
C ++ uses the _ cdecl call method by default. Therefore, when calling a DLL in VC, you should use the _ stdcall call convention. In C compilation mode, __cdecl indicates that only the name of the output function is underlined, such as _ functionname. (3) _ fastcall: the _ fastcall call is faster. It passes parameters through the internal CPU registers. (In fact, it uses ECx and EDX to transmit the first two DWORD or smaller parameters, and the remaining parameters are still transmitted from the right to the left pressure stack, the called function clears the memory stack of the transfer parameter before returning), and adds the "@" symbol before the output function name according to the C compilation method, __fastcall call convention, followed by the "@" symbol and the number of parameters in bytes, such as @ functionname @ NNN select the Runtime Library Reference this article: http://blog.csdn.net/wangqiulin123456/article/details/8877221 selection structure alignment
  • Customize
Automatically select function-level connections and strings to be taken offline
  • Optimizations
Allows fine-tuned optimization of a project

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.