<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"Lucida Console";
        panose-1:2 11 6 9 4 5 4 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:9.0pt;
        font-family:Consolas;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
span.EmailStyle19
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-AU link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>If  you have written any programs based on
PTLib/OpenH323/H323plus/OPAL, please read this, IT’S IMPORTANT!!<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Adam Butcher from Selex Communications submitted patches a
while ago to change BOOL to PBoolean. The reason was so that PBoolean could be defined
as the ANSI standard bool type and we get a whole pile of beneficial compile
time checks. The process found a couple of places where a function had a BOOL
return type but integer (tri-state) values were being returned!<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Well, Craig and I had thought of this for a while as being a
“good thing” to do, but lack of time has always been an issue. Now,
as we have been presented with all the hack work, it seems that this is
it’s time.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Of course things are NEVER easy. The change has a nasty API
issue that can silently stop user programs from working. It revolves around my
#1 pet hate in C++, if you change the signature of a virtual function,
overrides silently no longer override the virtual. For example:<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoPlainText>   //------ in the library<o:p></o:p></p>

<p class=MsoPlainText>   class OpalXXX<o:p></o:p></p>

<p class=MsoPlainText>   {<o:p></o:p></p>

<p class=MsoPlainText>        virtual void
SomeFunction( PBoolean );<o:p></o:p></p>

<p class=MsoPlainText>   };<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoPlainText>   //------- in some unchanged dependent code
in another application<o:p></o:p></p>

<p class=MsoPlainText>   class MyXXX : public OpalXXX<o:p></o:p></p>

<p class=MsoPlainText>   {<o:p></o:p></p>

<p class=MsoPlainText>         virtual
void SomeFunction( BOOL );<o:p></o:p></p>

<p class=MsoPlainText>   };<o:p></o:p></p>

<p class=MsoPlainText><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>The function MyXXX::SomeFunction() will not be called as it should
be. And the stupid compiler (NONE of the compilers) give any warnings or
indication there is an issue. Way back in the preliminary versions of C++ they
did have a keyword “override” which would do exactly what we want,
error if the base class does not have the function being overridden as virtual.
The original designers (Stroustrup et al) took out, for presumably good
reasons, though I cannot for the life of me think what! There is even a number
proposals, e.g. <a
href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2108.html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2108.html</a>,
to put a variants of it back and Microsoft have even done so, <a
href="http://msdn2.microsoft.com/en-us/library/41w3sh1c.aspx">http://msdn2.microsoft.com/en-us/library/41w3sh1c.aspx</a>,
on their latest compiler.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Anyway we have to deal with existing compilers and this
problem is really insidious, but we think the gains are worth the pain. And we
have provided a work around for people.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>So, what we need from you guys is please check out the PTLib
and OPAL in the branches:<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>   <a
href="https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/branches/BooleanChange">https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/ptlib/branches/BooleanChange</a><o:p></o:p></p>

<p class=MsoNormal>   <a
href="https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/branches/BooleanChange">https://opalvoip.svn.sourceforge.net/svnroot/opalvoip/opal/branches/BooleanChange</a><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>and compile your programs against it. Now by default it will
use the ANSI bool form of PBoolean, so any overrides of PTLib or OPAL functions
must be changed to use PBoolean instead of BOOL. For those not using MFC, this
is really easy, just do a complete search and replace everywhere of BOOL to
PBoolean (or better yet, just bool) and that should do the job. Oh, you might
like to search and replace TRUE to true and FALSE to false while you are at it,
though you don’t HAVE to do that.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Now, for those that simply do not wish to make these changes,
we have a backward compatibility option: use the<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><span style='font-size:9.0pt;font-family:"Lucida Console"'> 
--disable-ansi-bool</span><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>option with configure (both Unix and Win32) and PBoolean is
defined as BOOL instead of bool. This should (in theory) be 100% compatible with
the previous signatures. So no changes to applications based on PTLib need be
made.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>But we need you guys to CHECK THAT THIS IS OK!<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>We are currently proposing to merge it into the trunk on
Monday 26<sup>th</sup> of November, we are happy to extend that if asked, but will
not wait forever, the back merging is really painful!<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>P.S. A random note to developers, the PBoolean is only there
for backward compatibility. It is recommended that any NEW functions all just
use the bool keyword. Use lowercase true and false too.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>P.P.S. Sorry about all the shouting ... <span
style='font-family:Wingdings'>J</span><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Robert Jongbloed<o:p></o:p></p>

<p class=MsoNormal>OPAL/OpenH323 Architect and Co-founder.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

</div>

</body>

</html>