Show: Delphi C++
Display Preferences

C++ Compiler Advanced

From RAD Studio
Jump to: navigation, search

Go Up to C++ Compiler


Project > Options > C++ Compiler > Advanced

Use this dialog box to set C++ Compiler Advanced Compilation options.

Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.


Assembler Options

Assembler Options Description Compiler switches
bcc32 bcc32c bcc64 bccosx bcciosarm bcciosarm64 bccaarm

Assembler options

Enter any additional assembler options (such as -TX or -T) that you want for the current project. Passes the specified option(s) to the assembler that you specify with the Specify which assembler to use option or the default assembler (TASM32 in 32-bit Windows).

Clang-enhanced compilers for 32-bit do not produce assembly files that can be assembled with TASM32.

N/A Platform not supported Platform not supported Platform not supported Platform not supported Platform not supported

Compile to .ASM, then assemble to .OBJ

Causes the compiler to first generate an .ASM file from your C++ (or C) source code (same as the -S command-line option). The compiler then calls TASM32 (or the assembler specified in Specify which assembler to use) to create an .OBJ file from the .ASM file. The .ASM file is then deleted.

Your program will fail to compile with the -B option if your C or C++ source code declares static global variables that are keywords in assembly. This is because the compiler does not precede static global variables with an underscore (as it does with other variables), and the assembly keywords will generate errors when the code is assembled. The default is False.

Compile to .ASM
-S

Assemble to .OBJ
-B

N/A



Platform not supported

N/A



Platform not supported

N/A



N/A

N/A



Platform not supported

N/A



Platform not supported

N/A



Platform not supported

Specify which assembler to use

Assemble instructions using the specified filename as the assembler. The 32-bit Windows compiler uses TASM32 as the default assembler. The Ellipsis pop-up button is described in Common Items on Project Options Pages.

-E

Platform not supported

Platform not supported

N/A

Platform not supported

Platform not supported

Platform not supported

Floating Point Options

Floating point Options Description Compiler switches
  bcc32     bcc32c     bcc64     bccosx     bcciosarm     bcciosarm64     bccaarm  

Correct FDIV flaw

Some early Pentium chips do not perform specific floating-point division calculations with full precision. Although chances of encountering this problem are slim, this switch inserts code that emulates floating-point division, so that you are assured of the correct result. This option decreases your program's FDIV instruction performance. Use of this option only corrects FDIV instructions in modules that you compile. The run-time library also contains FDIV instructions that are not modified by setting this switch. To correct the run-time libraries, you must recompile them using this switch.

The following functions use FDIV instructions in assembly language that are not corrected if you use this option:

acos, acosl, acos, asin, asinl, atan, atan2, atan2l, atanl, cos, cosh, coshl, cosl, exp, expl, fmod, fmodl, pow, pow10, pow10l, powl, sin, sinh, sinhl, sinl, tan, tanh, tanhl, tanl

Also, this switch does not correct functions that convert a floating-point number to or from a string (such as printf or scanf).
The default is False.

-fp

Platform not supported

Platform not supported

-fp

Platform not supported

Platform not supported

Platform not supported

Fast floating point

Floating-point operations are optimized without regard to explicit or implicit type conversions. Calculations can be faster than under ANSI operating mode.

The purpose of the fast floating-point option is to allow certain optimizations that are technically contrary to correct C semantics.

double x; x = (float) (3.5*x);

To execute this correctly, x is multiplied by 3.5 to give a double that is truncated to float precision, and then stores as a double in x. Under fast floating-point operation, the long double product is converted directly to a double. Since very few programs depend on the loss of precision on passing to a narrower floating-point type, fast floating point is on by default.

When this option is disabled (-ff-) the compiler follows strict ANSI rules regarding floating-point conversions.
The default is True.

-ff

Platform not supported

Platform not supported

-ff

Platform not supported

Platform not supported

Platform not supported

Quiet floating point compares

Use the quiet floating point instruction (FUCOMP).

The default is True.

-fq

Platform not supported

Platform not supported

-fq

Platform not supported

Platform not supported

Platform not supported

Required math functions to indicate errors

This option tells the compiler that programs can reliably test errno after calls to standard math library functions.
The default is True.

Platform not supported

-fmath-errno

-fmath-errno

Platform not supported

-fmath-errno

-fmath-errno

-fmath-errno

Other Options

Other Options Description Compiler switches
     bcc32           bcc32c          bcc64         bccosx         bcciosarm         bcciosarm64         bccaarm    

Additional options to pass to the compiler

Enter any additional compiler options that you want to add for the current project.

Code page

Sets the default text character set that is used in the ANSI source code if the source code does not contain a BOM (byte order mark).

Enables support for user-defined code pages. Its primary use is to tell the compiler how to parse and convert multibyte character strings (MBCS).

In the entry field, you can specify either:

  • The actual code page number. For example:
    • 1250 for European
    • 932 for Japanese
  • Text identifiers for code page encodings, such as UTF8, UTF32, or SJIS (representing Shift-JIS for Japanese)

For example, if you specify either 65001 or UTF8 for the -CP option, the compiler supports UTF8 encoding for source code without BOM.

There are two distinct areas where code pages come into effect:

  • String constants, comments, #error, and #pragma directives
For MBCS strings belonging to this set, you must specify the correct codepage using a call to the Windows API function IsDBCSLeadByteEx. Using this function, specify the code page to correctly parse the MBCS strings for a particular locale (this, for example, enables the compiler to correctly parse backslashes in MBCS trail bytes.)
For MBCS strings belonging to this set (wide-char string constants), specify the correct code page to convert the MBCS strings to Unicode strings using the Windows API function MultiByteToWideChar.

Syntax

Enable code paging with the following command-line switch:

-CPnnnn

In this syntax, nnnn is the numeric value of the code page you need to use for your specific locale.
The following rules apply:

  1. When setting code paging, numeric values must adhere to the Microsoft NLS Code Page ID values. For example:
    • Use 437 code page for United States MS-DOS applications.
    • Use 932 for Japanese.
  2. The numeric value must be a valid code page supported by the OS.
  3. Users might need to install the relevant Windows NLS files to make certain Asian locales and code pages accessible. Refer to the Microsoft NLS Code Page list for specifics.
  4. If you do not specify a code page value, the compiler calls the Windows API function GetACP to retrieve the system's default code page and uses this value when handling strings as indicated above.

The default is to not use a code page.

-CP

-finput-charset=0

N/A

-CP

N/A

N/A

N/A

Execution Character Set

Sets the Execution Character Set, which is used for ANSI strings in the executable file.

The Execution Character Set option is designed for use with multi-device applications.
For the Windows host or a Windows target, the default text encoding is equal to the application's ANSI encoding (the Code page option).
For a multi-device application, however, the target's ANSI encoding might not be the same as the host's ANSI encoding.
For example, POSIX systems (including OS X and the latest Linux) use UTF8 as system encoding, so Execution Character Set must be "UTF8".

If you compile an application with "932" as Execution Character Set, all string literals are compiled as "932" (Japanese SJIS) encoding regardless of whether the compile-time environment is "932". Wide-string literals (for example L"Test") are not affected by this option.

In some instances, the value of the Code page option is used for the Execution Character Set option. The following matrix represents the relationship between the Code page and Execution Character Set options:

Is the option defined? Description
Code page Execution Character Set
  • For a Windows target, the compiler uses the Windows system code page (CP_ACP) as both the text character set and the execution character set.
  • For an OS X target, the compiler uses the Windows system code page (CP_ACP) as the text character set, and UTF-8 as the execution character set on OS X.
YesC++11Feature.png

The compiler uses the Code page value as both the text character set and the execution character set.

YesC++11Feature.png

The compiler uses the Execution Character Set value as the execution character set and uses the system code page (CP_ACP) for a Windows target, or a platform-specific encoding for a multi-device target (LC_CTYPE on OS X).

YesC++11Feature.png
YesC++11Feature.png

Compiler uses the Code page value as the text character set and the Execution Character Set value as the execution character set.

-CE

-fexec-charset=0

N/A

-CE

N/A

N/A

N/A

Minimum contiguous memory allocation block size

Specifies the minimum size used for contiguous memory allocation.

The default is (no =nMB), which means to use the largest possible chunk.

For example, you might want to set this option for compiling large projects that do not use PCH or for very large (perhaps machine generated) source files, ones that have many included source leading to many declarations per file.

-savemem

Platform not supported

Platform not supported

-savemem

Platform not supported

Platform not supported

Platform not supported

Unsigned char type

The compiler treats char declarations as if they were of unsigned char type, which provides compatibility with other compilers.
The default is False (char type is signed.)

-K

-funsigned-char

N/A

-K

N/A

N/A

N/A

Generate iOS universal binary file (armv7 + arm64)

The compiler creates a universal binary file for both 32-bit and 64-bit iOS.
The default is False (only 64-bit binary is created).

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Source Options

Source Options Description Compiler switches
  bcc32     bcc32c     bcc64     bccosx     bcciosarm     bcciosarm64     bccaarm  

Enable nested comments

Nests comments in your C and C++ source files. Nested comments are not allowed in standard C implementations, and they are not portable.
The default is False.

Note: You can use conditional compiling directives to "comment" a large block of code containing comments:

 #if 0
 // ...
 /* ... */
 #endif

-C

Platform not supported

Platform not supported

-C

Platform not supported

Platform not supported

Platform not supported

Identifier length

Specifies the number of significant characters (those that are recognized by the compiler) in an identifier. Except in C++, which recognizes identifiers of unlimited length, all identifiers are treated as distinct only if their significant characters are distinct. This includes variables, preprocessor macro names, and structure member names.

Valid numbers for length are 0, and 8 through 250, where 0 means use the maximum identifier length of 250. By default, C++Builder uses 250 characters per identifier. Other systems (including some UNIX compilers) ignore characters beyond the first eight. If you are porting to other environments, you might want to compile your code with a smaller number of significant characters, which helps you locate name conflicts in long identifiers that have been truncated. The default is 250.

-i

Platform not supported

Platform not supported

-i

Platform not supported

Platform not supported

Platform not supported

String Options

String Options Description Compiler switches
  bcc32     bcc32c     bcc64     bccosx     bcciosarm     bcciosarm64     bccaarm  

Merge duplicate strings

Merges two literal strings when one matches another. This produces smaller programs (at the expense of a slightly longer compile time) but can introduce errors if you modify one string.
The default is False.

-d

-fmerge-all-constants

N/A

-d

N/A

N/A

N/A

Read-only strings

Put memory allocated for strings into the read-only data segment. The default is False.

-dc

-fconst-strings

N/A

-dc

N/A

N/A

N/A

Writable strings

Put memory allocated for strings into the writable data segment.
The default is False.

-dw

-fwritable-strings

N/A

-dw

N/A

N/A

N/A

See Also

Personal tools
In other languages
Previous Versions
Assistance