C++ Compiler Compatibility

From RAD Studio
Jump to: navigation, search

Go Up to C++ Compiler Index

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.

Note: Several compatibility options have switches beginning with -Vb. These options are summarized in the following table:
Command-Line Switch Meaning

-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.

-Vbe

Allow old-style explicit template specialization.

-Vbn

Allow calling a non-const member function for a const object.

-Vbo

Use old overload resolution rules.

-Vbr

Allow non-const reference binding.

-Vbs

Do not treat string literals as const.

-Vbt

Use old Borland type rules for ternary operators.

-Vbx

Allow explicit template specializations as member functions.


Options Description

Build Configuration Options

Described in Build Configuration Options.

Common Options

Described in Common Items on Project Options Pages.


C++ Compatibility options Description

'Slow' virtual base pointers
(-Vv)

Uses 'slow' virtual base pointers. Default = False

Constructor displacements
(-Vc)

Supports constructor displacements. Default = False

Explicit template specialization as member function
(-Vbx)

Allow explicit template specializations as member functions. Default = False

Old Borland class layout
(-VI)

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

Old style class arguments
(-Va)

Supports old style class arguments. Default = False

Old-style explicit template specialization
(-Vbe)

Allow old-style explicit template specialization. Default = False

Old style virdef generation
(-Vs)

Uses old-style virdef generation. Default = False

Push 'this' first
(-Vp)

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

VC++ compatibility
(-VM)

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

VTable in front
(-Vt)

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

Zero-length empty base class
(-Ve)

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

Zero-length empty class member functions
(-Vx)

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



General option Description

Backward compatibility
(-Vb)

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

Disable lexical digraph scanner
(-Vg)

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

Don't collapse ref-to-ref and allow qualified references
(-Vbc)

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.

A qualified reference was also illegal previously. The new rules call for the qualifiers to be collapsed when they are the result of a typedef. For example:

typedef int & intr;
typedef intcr const; 

Under the new C++ rules, intcr is legal and is the same type as intr. Bcc32 follows these rules by default. Under the previous rules, intcr would be illegal, but bcc32 Rev 5.9 (and before) allowed this, treating the type as if qualified references were legal. If you specify -Vbc, intcr is treated as the type int & const.

Don't mangle calling convention
(-VC)

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

Enable all compatibility options
(-Vo)

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

Enable new operator names
(-Vn)

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

for-statement scoping
(-Vd)

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

Global functions in segments (
-VA)

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

Microsoft header search algorithm
(-VI)

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

Native code for MBCS
(-Vw)

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

Non-const calls for const object
(-Vbn)

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

Non-const reference binding
(-Vbr)

Allow non-const reference binding.
Default = False

Non-const string literals
(-Vbs)

Do not treat string literals as const.
Default = False

Old 8.3 include search
(-Vi)

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

Old overload resolution
(-Vbo)

Use old overload resolution rules.
Default = False

Reverse Multi-character constants
(-Vr)

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



General option Description

Default

Saves the current settings as the default for each new project.

Personal tools
Newest Version: XE
In other languages