[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Adding new data members to classes without d-pointer
From:       Carlos Ernesto Alies Fuentes <cafu2002sea () hotmail ! com>
Date:       2012-07-26 7:59:35
Message-ID: BLU154-W156CF8A4BD8866A3E04A7FA9C20 () phx ! gbl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi All,Greetings my first post, hopefully helpful for someone else besides myself.I \
am facing difficulties trying to understand the wiki page Policies/Binary \
Compatibility Issues With C++ in the sectionAdding new data members to classes \
without d-pointer. I think the docu is wrong (please forgive and coreect me if i am \
wrong) the code sample following was taken from the docu and i have added some \
comment using triple slash (///):Code: Select all// BCI: Add a real d-pointer \
Q_GLOBAL_STATIC(QHash<Foo *,FooPrivate>, d_func); ///FooPrivate is not declare as a \
pointer here. static FooPrivate* d( const Foo* foo )
{
 // i think here it would failed since is expecting a pointer or?
    FooPrivate* ret = d_func()->value( foo, 0 );
    if ( ! ret ) {
        ret = new FooPrivate;///here is a pointer
        d_func()->insert( foo, ret ); 
    }
    return ret;
}
static void delete_d( const Foo* foo )
{
    FooPrivate* ret = d_func()->value( foo, 0 );
///delete is called without validating the pointer
    delete ret;
    d_func()->remove( foo );
}The question is about the pointers usage here.cafu

Re: Adding new data members to classes without d-pointerThu Jul 26, 2012 7:24 am from \
bcooksley Given the nature of this problem, I would prefer to delegate to the people \
more versed in binary compatibility. Binary compatibility is very important to KDE.

Please send an email regarding this to kde-devel@kde.org. 		 	   		  


[Attachment #5 (text/html)]

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br><br><span style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica \
Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); ">Hi All,</span><br style="color: rgb(46, 52, \
54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; \
line-height: 20px; text-align: left; background-color: rgb(255, 255, 255); "><br \
style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, \
Arial, sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, \
255, 255); "><span style="color: rgb(46, 52, 54); font-family: 'Open Sans', \
'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); ">Greetings my first post, hopefully helpful \
for someone else besides myself.</span><br style="color: rgb(46, 52, 54); \
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; \
line-height: 20px; text-align: left; background-color: rgb(255, 255, 255); "><br \
style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, \
Arial, sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, \
255, 255); "><span style="color: rgb(46, 52, 54); font-family: 'Open Sans', \
'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); ">I am facing difficulties trying to understand \
the wiki page&nbsp;</span><span style="color: rgb(46, 52, 54); font-family: 'Open \
Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: \
left; background-color: rgb(255, 255, 255); font-weight: bold; ">Policies/Binary \
Compatibility Issues With C++</span><span style="color: rgb(46, 52, 54); font-family: \
'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; \
text-align: left; background-color: rgb(255, 255, 255); ">&nbsp;in the \
section</span><span style="color: rgb(46, 52, 54); font-family: 'Open Sans', \
'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); font-weight: bold; ">Adding new data members to \
classes without d-pointer</span><span style="color: rgb(46, 52, 54); font-family: \
'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; \
text-align: left; background-color: rgb(255, 255, 255); ">. I think the docu is wrong \
(please forgive and coreect me if i am wrong) the code sample following was taken \
from the docu and i have added some comment using triple slash (///):</span><br \
style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, \
Arial, sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, \
255, 255); "><dl class="codebox" style="margin-bottom: 1.6em; border: 1px solid \
rgba(0, 0, 0, 0.246094); border-top-left-radius: 4px; border-top-right-radius: 4px; \
border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; background-color: \
rgb(251, 251, 251); padding: 5px; -webkit-box-shadow: rgba(0, 0, 0, 0.0976563) 0px \
4px 3px; box-shadow: rgba(0, 0, 0, 0.0976563) 0px 1px 4px; color: rgb(46, 52, 54); \
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; \
line-height: 20px; text-align: left; "><dt style="line-height: 1.6em; font-weight: \
bold; margin-left: 5px; margin-right: 5px; padding-bottom: 3px; margin-bottom: 8px; \
border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(229, \
229, 229); ">Code:&nbsp;<a \
href="http://forum.kde.org/viewtopic.php?f=64&amp;t=107012#" style="color: rgb(0, \
104, 198); text-decoration: none; ">Select all</a></dt><dd style="line-height: 1.6em; \
margin-left: 5px; margin-right: 5px; max-height: 500px; overflow: auto; "><code \
style="padding: 0px; font-family: Menlo, Monaco, 'Courier New', monospace; color: \
rgb(221, 17, 68); border-top-left-radius: 3px; border-top-right-radius: 3px; \
border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: \
transparent; border: 0px; margin: 5px 5px 5px 0px; max-height: 340px; overflow-y: \
auto; ">// BCI: Add a real d-pointer<br>Q_GLOBAL_STATIC(QHash&lt;Foo \
*,FooPrivate&gt;, d_func); ///FooPrivate is not declare as a pointer here.<br>static \
FooPrivate* d( const Foo* foo )<br>{<br>&nbsp;// i think here it would failed since \
is expecting a pointer or?<br>&nbsp; &nbsp; FooPrivate* ret = d_func()-&gt;value( \
foo, 0 );<br>&nbsp; &nbsp; if ( ! ret ) {<br>&nbsp; &nbsp; &nbsp; &nbsp; ret = new \
FooPrivate;///here is a pointer<br>&nbsp; &nbsp; &nbsp; &nbsp; d_func()-&gt;insert( \
foo, ret );&nbsp;<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; return ret;<br>}<br>static void \
delete_d( const Foo* foo )<br>{<br>&nbsp; &nbsp; FooPrivate* ret = \
d_func()-&gt;value( foo, 0 );<br>///delete is called without validating the \
pointer<br>&nbsp; &nbsp; delete ret;<br>&nbsp; &nbsp; d_func()-&gt;remove( foo \
);<br>}</code></dd></dl><br style="color: rgb(46, 52, 54); font-family: 'Open Sans', \
'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); "><br style="color: rgb(46, 52, 54); \
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; \
line-height: 20px; text-align: left; background-color: rgb(255, 255, 255); "><span \
style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, \
Arial, sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, \
255, 255); ">The question is about the pointers usage here.</span><br style="color: \
rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, \
sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, 255, \
255); "><br style="color: rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica \
Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); "><span style="color: rgb(46, 52, 54); \
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; \
line-height: 20px; text-align: left; background-color: rgb(255, 255, 255); \
">cafu</span> <div><span style="color: rgb(46, 52, 54); font-family: 'Open Sans', \
'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; text-align: left; \
background-color: rgb(255, 255, 255); "><br></span></div><div><div \
class="postbit-header" style="margin-top: -15px; margin-left: -20px; margin-bottom: \
15px; padding: 15px 15px 5px 20px; background-color: rgba(0, 0, 0, 0.0195313); color: \
rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, \
sans-serif; line-height: 20px; text-align: left; "><h3 class="postbit-subject \
nomargin wrap" style="margin: 0px !important; font-family: 'Open Sans Light', \
'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: normal; color: rgb(32, \
74, 135); text-rendering: optimizelegibility; text-shadow: white 0px 1px 0px; \
line-height: 1em; font-size: 1.3em; word-wrap: break-word !important; max-width: \
680px; "><a href="http://forum.kde.org/viewtopic.php?f=64&amp;t=107012#p246880" \
style="color: rgb(0, 104, 198); text-decoration: none; ">Re: Adding new data members \
to classes without d-pointer</a></h3><div class="postbit-date" style="font-size: \
0.85em; margin-top: 5px !important; margin-bottom: 10px !important; ">Thu Jul 26, \
2012 7:24 am from&nbsp;<a \
href="http://forum.kde.org/memberlist.php?mode=viewprofile&amp;u=21" \
class="username-coloured" style="font-size: 10pt; color: rgb(11, 88, 11); \
text-decoration: none; text-align: center; background-color: rgb(255, 255, 255); \
">bcooksley</a><span style="font-size: 10pt; text-align: center; background-color: \
rgb(255, 255, 255); ">&nbsp;</span></div></div><div id="article246880" style="color: \
rgb(46, 52, 54); font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, \
sans-serif; line-height: 20px; text-align: left; background-color: rgb(255, 255, \
255); ">Given the nature of this problem, I would prefer to delegate to the people \
more versed in binary compatibility. Binary compatibility is very important to \
KDE.<br><br>Please send an email regarding this to&nbsp;<a \
href="mailto:kde-devel@kde.org" style="color: rgb(0, 104, 198); text-decoration: \
none; ">kde-devel@kde.org</a>.</div></div> 		 	   		  </div></body> </html>



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic