Show: Object Pascal C++
Display Preferences

C++ Compiler Compatibility

From Appmethod Topics
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 support
  bcc32     bcc32c     bcc64     bccosx     bcciosarm     bcciosarm64     bccaarm  

'Slow' virtual base pointers

Uses 'slow' virtual base pointers. Default = False

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

Constructor displacements

Supports constructor displacements. Default = False

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

Explicit template specialization as member function

Allow explicit template specializations as member functions. Default = False

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

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 Appmethod C++. Enable this option if you need to compile source files that you intend to use with older versions of Appmethod C++ (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

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

Old-style class arguments

Supports old style class arguments. Default = False

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

Old-style explicit template specialization

Allow old-style explicit template specialization. Default = False

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

Old style virdef generation

Uses old-style virdef generation. Default = False

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

Push 'this' first

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

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

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

YesC++11Feature.png

VTable in front

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

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

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

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

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

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

General Options

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

Backward compatibility

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

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

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

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

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 enable the Don't collapse ref-to-ref option, intrr is reported as an error just as it previously would have been an error.

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

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

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

Enable all compatibility options

Enables most of the compatibility options used with old code:

  • 'Slow' virtual base pointers
  • Old-style class arguments
  • Push 'this' first
  • VTable in front
  • Constructor displacements
  • for -statement scoping
  • Zero-length empty class member functions

Default = False

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

Enable new operator names

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

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

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

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

Global functions in segments

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

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

Microsoft header search algorithm

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

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

Native code for MBCS

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

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

Non-const calls for const object

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

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

Non-const reference binding

Allow non-const reference binding.
Default = False

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

Non-const string literals

Do not treat string literals as const.
Default = False

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

Old 'using' rules in templates

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

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

Old 8.3 include search

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

YesC++11Feature.png

Old overload resolution

Use old overload resolution rules.
Default = False

YesC++11Feature.png

Old type rules for ternary operators

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

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

Reverse Multi-character constants

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

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

-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