C++ Compiler Compatibility

From RAD Studio
Jump to: navigation, search

Go Up to C++ Compiler


Project > Options > C++ Compiler > Compatibility

Use this dialog box to set specific C++ compiler compatibility options.

The options on this dialog box provide backward compatibility with previous versions of the compiler. In general, these options should only be set to True when such compatibility is required. Their default values are typically False.


Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.

C++ Compatibility Options

C++ Compatibility Options Description Compiler switches
  bcc32     bcc32c     bcc64     bccosx     bcciosarm     bcciosarm64     bccaarm  

'Slow' virtual base pointers

Uses 'slow' virtual base pointers. Default = False

-Vv

N/A

Platform not supported

-Vv

Platform not supported

Platform not supported

Platform not supported

Constructor displacements

Supports constructor displacements. Default = False

-Vc

N/A

Platform not supported

-Vc

Platform not supported

Platform not supported

Platform not supported

Explicit template specialization as member function
(-Vbx)

Allow explicit template specializations as member functions. Default = False

-Vbx

N/A

Platform not supported

-Vbx

Platform not supported

Platform not supported

Platform not supported

Old Borland class layout

This is a backward compatibility switch that causes the C++ compiler to lay out derived classes the same way it did in older versions of C++Builder. Enable this option if you need to compile source files that you intend to use with older versions of C++Builder (for example, if you need to work with a DLL that you cannot recompile, or if you have older data files that contain hardwired class layouts). Default = False

-Vl

N/A

Platform not supported

-Vl

Platform not supported

Platform not supported

Platform not supported

Old-style class arguments

Supports old style class arguments. Default = False

-Va

N/A

Platform not supported

-Va

Platform not supported

Platform not supported

Platform not supported

Old-style explicit template specialization

Allow old-style explicit template specialization. Default = False

-Vbe

N/A

Platform not supported

-Vbe

Platform not supported

Platform not supported

Platform not supported

Old style virdef generation

Uses old-style virdef generation. Default = False

-Vs

N/A

Platform not supported

-Vs

Platform not supported

Platform not supported

Platform not supported

Push 'this' first

Like Pascal, pushes 'this' first. The compiler typically pushes parameters on the stack from right to left. Default = False

-Vp

N/A

Platform not supported

-Vp

Platform not supported

Platform not supported

Platform not supported

VC++ compatibility

To provide compatibility with Microsoft Visual C++, substitutes __msfastcall for __fastcall calling convention. This switch should not be used when working with a VCL application. It causes numerous linker errors. Default = False

-VM

N/A

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Platform not supported

VTable in front

Puts virtual table pointer at front of object layout. Default = False

-Vt

N/A

Platform not supported

-Vt

Platform not supported

Platform not supported

Platform not supported

Zero-length empty base class

Usually the size of a class is at least one byte, even if the class does not define any data members. When you set this option, the compiler ignores this unused byte for the memory layout and the total size of any derived classes; empty base classes do not consume space in derived classes. Default = False

-Ve

N/A

Platform not supported

-Ve

Platform not supported

Platform not supported

Platform not supported

Zero-length empty class member functions

Usually the size of a data member in a class definition is at least one byte. When this option is enabled, the compiler allows an empty structure of zero length. Default = False

-Vx

N/A

Platform not supported

-Vx

Platform not supported

Platform not supported

Platform not supported

General Options

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

Backward compatibility

Enables all the compatibility -Vxxx options for backward compatibility. Default = False

-Vb

N/A

Platform not supported

-Vb

Platform not supported

Platform not supported

Platform not supported

Disable lexical digraph scanner

Disables the lexical digraph scanner. Digraphs are two character sequences that stand in for a single character that may be hard to produce on certain keyboards. If this option is true, then such diagraphs are not recognized. Default = False

-Vg

N/A

Platform not supported

-Vg

Platform not supported

Platform not supported

Platform not supported

Don't collapse ref-to-ref

Previously, a reference to a reference was illegal. The new default behavior is to follow the C++11 rules. The compiler now collapses the two references.

For example:

typedef int & intr;
typedef intrr &;

The type intrr is legal, the same type as intr under the new C++ rules. Bcc32 (Rev. 6.0 and above) follows these rules by default. Under the previous C++ rules, intrr would be illegal. If you enable the Don't collapse ref-to-ref option, intrr is reported as an error just as it previously would have been an error.

-Vbc

N/A

Platform not supported

-Vbc

Platform not supported

Platform not supported

Platform not supported

Don't mangle calling convention

When this option is set, the compiler disables the distinction of function names where the only possible difference is incompatible code generation options. For example, with this option set, the linker does not detect if a call is made to a __fastcall member function with the cdecl calling convention.This option is provided for backward compatibility only; it lets you link old library files that you cannot recompile. Default = False

-VC

N/A

Platform not supported

-VC

Platform not supported

Platform not supported

Platform not supported

Enable all compatibility options

Enables most of the compatibility options used with old code:

  • 'Slow' virtual base pointers -Vv
  • Old-style class arguments -Va
  • Push 'this' first -Vp
  • VTable in front -Vt
  • Constructor displacements -Vc
  • for -statement scoping -Vd
  • Zero-length empty class member functions -Vx

Default = False

-Vo

N/A

Platform not supported

-Vo

Platform not supported

Platform not supported

Platform not supported

Enable new operator names

Enables new operator names such as 'and', 'or', 'and_eq', 'bitand', and so forth. Default = False

-Vn

N/A

Platform not supported

-Vn

Platform not supported

Platform not supported

Platform not supported

for -statement scoping

Specifies the scope of variables declared in for loop expressions. The output of the following code segment changes, depending on the setting of this option:

int main(void)
{
  for(int i=0; i<10; i++)
  {
    cout << "Inside for loop, i = " << i << endl;
  } //end of for-loop block
  cout << "Outside for loop, i = " << i << endl; //error without this option
} //end of block containing for loop

If this option is disabled (the default), the variable i goes out of scope when processing reaches the end of the for loop. Because of this, you will get an Undefined Symbol compilation error if you compile this code with this option disabled.

If the for -statement scoping option is enabled, the variable i goes out of scope when processing reaches the end of the block containing the for loop. In this case, the code output would be:

Inside for loop, i = 0
...
Outside for loop, i = 10

Default = False

-Vd

N/A

Platform not supported

-Vd

Platform not supported

Platform not supported

Platform not supported

Global functions in segments

Generates all global functions in their own virtual or weak segment.
Default = True

-VA

N/A

Platform not supported

-VA

Platform not supported

Platform not supported

Platform not supported

Microsoft header search algorithm

Uses Microsoft search algorithms to locate the header files.
Default = True

-VI

N/A

Platform not supported

-VI

Platform not supported

Platform not supported

Platform not supported

Native code for MBCS

Emits native code instead of Unicode for multi-byte character.
Default = False

-Vw

N/A

Platform not supported

-Vw

Platform not supported

Platform not supported

Platform not supported

Non-const calls for const object

Allow calling a non-const member function for a const object.
Default = False

-Vbn

N/A

Platform not supported

-Vbn

Platform not supported

Platform not supported

Platform not supported

Non-const reference binding

Allow non-const reference binding.
Default = False

-Vbr

N/A

Platform not supported

-Vbr

Platform not supported

Platform not supported

Platform not supported

Non-const string literals

Do not treat string literals as const.
Default = False

-Vbs

N/A

Platform not supported

-Vbs

Platform not supported

Platform not supported

Platform not supported

Old 'using' rules in templates

Use the old Borland rules for 'using' in templates.
Default = False

-Vbu

N/A

Platform not supported

-Vbu

Platform not supported

Platform not supported

Platform not supported

Old 8.3 include search

Use old 8.3 search algorithm to locate header files.
Default = False

-Vi

N/A

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Old overload resolution

Use old overload resolution rules.
Default = False

-Vbo

N/A

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Platform not supported

Old type rules for ternary operators

Use the old Borland type rules for ternary operators.
Default = False

-Vbt

N/A

Platform not supported

-Vbt

Platform not supported

Platform not supported

Platform not supported

Reverse Multi-character constants

The compiler reverses the order of Multi-character constants.
Default = False

-Vr

N/A

Platform not supported

-Vr

Platform not supported

Platform not supported

Platform not supported

-Vb Compiler Options for BCC32/BCCOSX

Note: Several compatibility options have compiler switches for BCC32 and BCCOSX that begin with -Vb. BCC64 does not support these compatibility options. The -Vb compatibility options are summarized in the following table:

Command-Line Switch Meaning

-Va

Support old-style class arguments.

-Vb

Turn on all -Vb switches. Enables backward compatibility with Bcc versions 5.8.2 and earlier.

-Vb+

Turn on all -Vb switches.

-Vb-

Turn off all -Vb switches.

-Vb.

Reset all -Vb switches to their default values. Available only on the command line, not in the IDE.

-Vbc

Do not collapse reference to reference and allow qualified references.

-Vbe

Allow old-style explicit template specialization.

-Vi

Use old 8.3 algorithm to locate header files.

-Vbn

Allow calling of non-const or non-volatile member function for a const or volatile object.

-Vbo

Use old Borland overload resolution rules.

-Vbr

Allow old Borland rules for reference binding.

-Vbs

Treat string literals as non-const.

-Vbt

Use old Borland type rules for ternary operators.

-Vbu

Use old Borland rules for using in templates.

-Vbx

Allow explicit template specializations as member functions.

See Also