Show: Delphi C++
Display Preferences

C++ Compiler Compatibility

From RAD Studio
Jump to: navigation, search

Go Up to C++ Compiler Project Options

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.

Contents


Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.



Note: Compiler switches that are given are for BCC32, not for BCC64.

C++ Compatibility Options

C++ Compatibility Options Description Compiler switches
  bcc32     bcc64     bccosx  

'Slow' virtual base pointers

Uses 'slow' virtual base pointers. Default = False

-Vv

Platform not supported

-Vv

Constructor displacements

Supports constructor displacements. Default = False

-Vc

Platform not supported

-Vc

Explicit template specialization as member function
(-Vbx)

Allow explicit template specializations as member functions. Default = False

-Vbx

Platform not supported

-Vbx

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

Platform not supported

-Vl

Old-style class arguments

Supports old style class arguments. Default = False

-Va

Platform not supported

-Va

Old-style explicit template specialization

Allow old-style explicit template specialization. Default = False

-Vbe

Platform not supported

-Vbe

Old style virdef generation

Uses old-style virdef generation. Default = False

-Vs

Platform not supported

-Vs

Push 'this' first

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

-Vp

Platform not supported

-Vp

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

Platform not supported

Platform not supported

VTable in front

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

-Vt

Platform not supported

-Vt

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

Platform not supported

-Ve

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

Platform not supported

-Vx

General Options

General Options Description Compiler switches
bcc32 bcc64 bccosx

Backward compatibility

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

-Vb

Platform not supported

-Vb

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

Platform not supported

-Vg

Don't collapse ref-to-ref

Previously, a reference to a reference was illegal. The new default behavior is to follow the C++0x 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 specify the -Vbc switch, intrr is reported as an error just as it previously would have been an error.

-Vbc

Platform not supported

-Vbc

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

Platform not supported

-VC

Enable all compatibility options

Sets most of the compatibility flags used with old code, enabling -Vv , -Va, -Vp, -Vt, -Vc, -Vd, and -Vx.
Default = False

-Vo

Platform not supported

-Vo

Enable new operator names

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

-Vn

Platform not supported

-Vn

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 -Vd
} //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'll get an Undefined Symbol compilation error if you compile this code with this option disabled.

If this option is set (-Vd), 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

Platform not supported

-Vd

Global functions in segments

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

-VA

Platform not supported

-VA

Microsoft header search algorithm

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

-VI

Platform not supported

-VI

Native code for MBCS

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

-Vw

Platform not supported

-Vw

Non-const calls for const object

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

-Vbn

Platform not supported

-Vbn

Non-const reference binding

Allow non-const reference binding.
Default = False

-Vbr

Platform not supported

-Vbr

Non-const string literals

Do not treat string literals as const.
Default = False

-Vbs

Platform not supported

-Vbs

Old 'using' rules in templates

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

-Vbu

Platform not supported

-Vbu

Old 8.3 include search

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

-Vi

Platform not supported

Platform not supported

Old overload resolution

Use old overload resolution rules.
Default = False

-Vbo

Platform not supported

Platform not supported

Old type rules for ternary operators

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

-Vbt

Platform not supported

-Vbt

Reverse Multi-character constants

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

-Vr

Platform not supported

-Vr

-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

Personal tools
In other languages