Recent Changes - Search:

Documents

Download

Building

Support

Wiki Stuff

edit SideBar

BoolChanges

Main.BoolChanges History

Hide minor edits - Show changes to output

Changed lines 44-47 from:
The presence of symbol P_USE_STANDARD_CXX_BOOL indicates that ANSI "bool" is being used, i.e. PBoolean is defined as "bool".

The presence of P_USE_INTEGER_BOOL indicates that
PBoolean is defined as 'int', which is backwards compatible with previous versions of PTLib
to:
The presence of symbol P_USE_STANDARD_CXX_BOOL indicates that a recent version of PTLib is being used, and ANSI "bool" has been selected, i.e. PBoolean is defined as "bool".

The presence of P_USE_INTEGER_BOOL indicates that that a recent version of
PTLib is being used, and PBoolean is defined as 'int', which is backwards compatible with previous versions of PTLib

The absence of both P_USE_INTEGER_BOOL and P_USE_STANDARD_CXX_BOOL indicates that an older version of PTlib/PWLib is being used, and that PBoolean/PTrue/PFalse are not defined.

Changed lines 26-27 from:
   #if defined(P_USE_STANDARD_CXX_BOOL) || defined(P_USE_INTEGER_BOOL)
  typedef PBoolean BOOL;
to:
   #if ! defined(P_USE_STANDARD_CXX_BOOL) && !defined(P_USE_INTEGER_BOOL)
  typedef BOOL PBoolean;
  #define PTrue TRUE
  #define PFalse FALSE
Changed lines 21-22 from:
If compatibility with previous versions of OPAL/PTLIB is not an issue, then replace all occurrences of 'BOOL' with 'bool', and 'bool' used for all subsequent boolean variables.
to:
If compatibility with previous versions of OPAL/PTLIB is not an issue, then replace all occurrences of 'BOOL' with 'bool', and use 'bool' for all subsequent boolean variables.
Added lines 5-6:
The symbols 'TRUE' and 'FALSE' have also been removed, replaced by 'PTrue' and 'PFalse'
Changed lines 36-37 from:
In either case, the action is the same as for Linux: replace all occurrences of 'BOOL' with 'bool', or replace with 'PBoolean' and add the code fragment above to all compilation units.
to:
In either case, the action is the same as for Linux: replace all occurrences of 'BOOL' with 'bool'; or replace with 'PBoolean' and add the code fragment above to all compilation units.
Deleted lines 37-45:

* Compile the program under Linux and change all of the 'BOOL' to 'bool'



!! How to use the new boolean type

For new developers, the onlty

Changed lines 46-54 from:

-
The Unix configure option "--disable-ansi-bool" will enable the old
"int BOOL" behaviour


- The new type PBoolean is be defined as either "bool" or "int" as required.


\Prior to these versions, the 'BOOL' symbol was used for
to:
The Unix configure option "--disable-ansi-bool" will enable the old "int BOOL" behaviour
Changed lines 3-6 from:
As of Barnard Devel 1 (Opal 3.1.1/PTLib 2.1.1), Opal and PTLib use the ANSI 'bool' type for all boolean variables and function parameters by default. This change has been implemented by replacing most occurrences of the symbol 'BOOL' with the new symbol 'PBoolean'. This new symbol is typedef-ed to 'bool' by default, but can be re-defined to 'int' for compatibility with previous software versions.

The symbol 'BOOL' is no longer defined within PTLib, except where it needed to call Windows functions.
to:
As of Barnard Devel 1 (Opal 3.1.1/PTLib 2.1.1), Opal and PTLib use the ANSI 'bool' type for all boolean variables and function parameters. This change has been implemented by replacing most occurrences of the symbol 'BOOL' with the new symbol 'PBoolean'. This new symbol is typedef-ed to 'bool' by default, but can be re-defined to 'int' for compatibility with previous software versions.

The symbol 'BOOL' is no longer defined by, or used within, PTLib except where needed to call Windows library functions.
Changed lines 17-26 from:
On Unix systems, any programs containing the symbol 'BOOL' will fail compilation. All occurrences of 'BOOL' should be replaced with 'PBoolean' (if backwards compatibility is

e time. This will automatically flag

 - which is a good way to locate code that needs changing.

On Windows, the symbol 'BOOL' is defined as part
of


to:
On Unix systems, any programs containing the symbol 'BOOL' will fail compilation.

If compatibility with previous versions of OPAL/PTLIB is not an issue, then replace all occurrences of 'BOOL' with 'bool', and 'bool' used for all subsequent boolean variables.

If compatibility with previous versions of OPAL/PTLib is required, then replace all occurrences
of 'BOOL' with 'PBoolean, and add the following code to each application compilation unit (preferably via a header file)

  #include <ptbuildopts.h>
  #if defined(P_USE_STANDARD_CXX_BOOL) || defined(P_USE_INTEGER_BOOL)
  typedef PBoolean BOOL;
  #endif

Defining 'BOOL' to 'PBoolean' for old versions of PTLib is '''not''' recommended, as this is not portable to Windows.
   
!! Effects on Windows software

On Windows, the symbol 'BOOL' is defined in <windows.h>, which means that Windows applications may still compile with the new versions of OPAL and PTLib but will not work. This is because any overrides of non-pure virtual functions in PTLib and Opal will have the incorrect linker signature.

This means that "search and replace" is the only way to find usages of 'BOOL' on Windows. If possible, compilation on Linux (as described above) provides a fool-proof way to find all such ocurrences.

In either case, the action is the same as for Linux: replace all occurrences of 'BOOL' with 'bool', or replace with 'PBoolean' and add the code fragment above to all compilation units.


* Compile the program under Linux and change all of the 'BOOL' to 'bool'



Changed lines 3-47 from:
As of Barnard Devel 1 (Opal 3.1.1/PTLib 2.1.1), Opal and PTLib use the ANSI 'bool' type for all boolean variables and function parameters.
to:
As of Barnard Devel 1 (Opal 3.1.1/PTLib 2.1.1), Opal and PTLib use the ANSI 'bool' type for all boolean variables and function parameters by default. This change has been implemented by replacing most occurrences of the symbol 'BOOL' with the new symbol 'PBoolean'. This new symbol is typedef-ed to 'bool' by default, but can be re-defined to 'int' for compatibility with previous software versions.

The symbol 'BOOL' is no longer defined within PTLib, except where it needed to call Windows functions.

!! Reasons for changing to ANSI bool

The change to ANSI bool was made for two important reasons:

* Improved compatibility with C++ libraries that are conformant to ANSI (such as STL)

* Improved compile time error detection, through use of a non-int boolean type.

!! Effects on Unix software

On Unix systems, any programs containing the symbol 'BOOL' will fail compilation. All occurrences of 'BOOL' should be replaced with 'PBoolean' (if backwards compatibility is

e time. This will automatically flag

 - which is a good way to locate code that needs changing.

On Windows, the symbol 'BOOL' is defined as part of



!! How to use the new boolean type

For new developers, the onlty

!! Detecting which boolean type is being used

The presence of symbol P_USE_STANDARD_CXX_BOOL indicates that ANSI "bool" is being used, i.e. PBoolean is defined as "bool".

The presence of P_USE_INTEGER_BOOL indicates that PBoolean is defined as 'int', which is backwards compatible with previous versions of PTLib

!! Configuring to use 'int' for boolean types


- The Unix configure option "--disable-ansi-bool" will enable the old
"int BOOL" behaviour


- The new type PBoolean is be defined as either "bool" or "int" as required.


\Prior to these versions, the 'BOOL' symbol was used for
Added lines 1-3:
!!Background

As of Barnard Devel 1 (Opal 3.1.1/PTLib 2.1.1), Opal and PTLib use the ANSI 'bool' type for all boolean variables and function parameters.
Edit - History - Print - Recent Changes - Search
Page last modified on January 28, 2008, at 11:42 PM