http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* OpenMP and functors - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/69a3ea80ba0eb730?hl=en
* Classes named CFoo (was Re: Odd Exception Behavior) - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/ce3a580936f3cddd?hl=en
* Incomplete types and std::vector - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/b0741c38fc15b5f7?hl=en
* Loop generates never-ending sockets and threads, need help debugging - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/bfb43e94d5fe70d1?hl=en
* Style guides for C and/or C++ - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/3543d1f01ca9b305?hl=en
* PHP to C++: HipHop for PHP ...thoughts? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a14b64504ddfa510?hl=en
* Why does a vector fail here? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/0f7f65bf6f4a8aa4?hl=en
* Motivation of software professionals - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/21a3fdec4dd53e6a?hl=en
* How to identify the exe file associated with core dump - 1 messages, 1
author
http://groups.google.com/group/comp.lang.c++/t/ae385d53872a2543?hl=en
* A design question .... - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/50b88a38cf4c0097?hl=en
* PODs, Constructors and the Boost uuid Class - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/a115833b71eecd59?hl=en
* Static const variables cause linker problems under Qt - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/f7acbdcaf443120e?hl=en
* ===Welcome to comp.lang.c++! Read this first. - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a801c2fa8f66c0a0?hl=en
* paypal wholesale Puma (paypal payment)(www.globlepurchase.com) - 1 messages,
1 author
http://groups.google.com/group/comp.lang.c++/t/47a934a1b114096e?hl=en
==============================================================================
TOPIC: OpenMP and functors
http://groups.google.com/group/comp.lang.c++/t/69a3ea80ba0eb730?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 2:42 pm
From: Robert Fendt
Hi all,
ok forget everything I said. I just forgot a 'private (j)'... shame on me. However, works now.
Regards,
Robert
==============================================================================
TOPIC: Classes named CFoo (was Re: Odd Exception Behavior)
http://groups.google.com/group/comp.lang.c++/t/ce3a580936f3cddd?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 2:43 pm
From: Jorgen Grahn
On Thu, 2010-02-04, none wrote:
> Alf P. Steinbach wrote:
...
>> * "C"-prefix for a class is a Microsoft-ism, therefore (almost
>> automatically)
>> ungood.
>
> Guilty as charged. I've been using the "C" prefix since the early days
> of Visual Studio.
More generally: I see this class CFoo scheme in a lot of postings
here. Why do people use it, *really*?
Microsoft may have had some reason to use it back in the 1980s or so,
before namespaces, before C++ was widely adopted, before their
programmers knew the language well, and they may have to keep it for
backwards-compatible reasons.
But that doesn't imply that *everyone else* has to use it, in their
own code, for new classes, in 2010. It provides no information and is
just in the way.
Are there broken tools in Microsoft-land which require it?
Misinformation in popular books? What?
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: Incomplete types and std::vector
http://groups.google.com/group/comp.lang.c++/t/b0741c38fc15b5f7?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 2:58 pm
From: Stephen Howe
> I think that the point is that using std::auto_ptr in the pimpl idiom
>doesn't save much work. You still need to write an explicit destructor
>(and possibly constructor) and forbid copying and assignment of the
>class. Basically you are more or less simply changing a "delete data;"
>in the destructor to a "std::auto_ptr" in the class declaration. Not
>much of a saving.
I believe there is a point to this and that is exception safety.
Suppose you have 2 + pointers that you new in the constructor
Suppose further that one of them might throw (or further down the line, another member object)
The constructor wiill gurantee that already constructed member objects will have the their destructors called before the throw
continues. But the bald pointers are not objects therefore there is a memory leak. delete or delete[] is not called.
In contrast, auto_ptr's will be correctly destroyed.
The lesson is if you think your sub-objects might throw
=> better use a RAII technique to wrap those bald pointers.
Any container is better than none.
This is about the only benefits of using auto_ptr here.
Stephen Howe
==============================================================================
TOPIC: Loop generates never-ending sockets and threads, need help debugging
http://groups.google.com/group/comp.lang.c++/t/bfb43e94d5fe70d1?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 3:16 pm
From: Jorgen Grahn
On Sat, 2010-02-06, Branimir Maksimovic wrote:
> Kurt wrote:
> While on the subject of threads and sockets,
>> do you have any books to recommend?
>
> Unix network programming, Richard Stevens.
> http://en.wikipedia.org/wiki/W._Richard_Stevens
Although that's for Unix, and the poster appeared to use some other
system. Stevens covers Unix and its variations, but not e.g. Windows.
For threads, I think you need more than Stevens -- I don't think he
teaches you to avoid all the pitfalls which makes all threaded code
I've seen a complicated, inefficient, and broken mess.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: Style guides for C and/or C++
http://groups.google.com/group/comp.lang.c++/t/3543d1f01ca9b305?hl=en
==============================================================================
== 1 of 2 ==
Date: Sat, Feb 6 2010 3:26 pm
From: Jorgen Grahn
On Tue, 2010-01-19, Vicent Giner-Bosch wrote:
> I've been searching at this forum and at the Internet for style
> guides for C and/or C++, and I've found these ones:
>
> http://www.psgd.org/paul/docs/cstyle/cstyle.htm
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
>
> Also, I've read some threads about C style matters. I think there is
> really a lot of stuff!
>
> I just would like to ask you for a quick answer to this question:
> which style guide or style rules do you recommend me to use when
> writing C/C++ code? It would be great if many of you would answer, so
> we all could have here a thread with a good summary about this
> subject.
You'll get no consensus or summary, that's for sure. Too many
different styles and opinions.
> PS: I've also posted this theme at comp.lang.c, so I apologize for
> cross-posting.
Thanks for mentioning it. Note that C and C++ are different
languages, and you cannot just mindlessly use the same style in both.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
== 2 of 2 ==
Date: Sat, Feb 6 2010 3:42 pm
From: Jorgen Grahn
On Tue, 2010-01-19, Timothy Madden wrote:
> Vicent Giner-Bosch wrote:
> [...]
>> I just would like to ask you for a quick answer to this question:
>> which style guide or style rules do you recommend me to use when
>> writing C/C++ code? It would be great if many of you would answer, so
>> we all could have here a thread with a good summary about this
>> subject.
>
> I write C++ and I use the following indentation which I care about:
>
> template< typename charT, typename traits=char_traits<charT> >
> class charConvertor
> {
> public:
> static
> std::basic_string<charT> strMessage;
>
> template<typename ExternalCharType>
> static
> inline
> void Transcode(ExternalCharType const *szMessage)
> {
> strMessage = szMessage;
> }
> }
> convertor;
>
> int main()
> {
> int iResult = 0;
>
> if
> (
> iResult <= 10
> &&
> iResult >= -2
> &&
> iResult == 0
> )
> {
> cout << "Right result";
> cout << endl;
>
> return iResult;
> }
> else
> ::CreateWindow
> (
> szClassName,
> szTitle,
> dwStyle,
> xPos,
> yPos,
> cxWidth,
> cxHeight,
> hwndParent
> );
>
> return -1;
> }
>
>
> It looks better with syntax highlighting though ... :)
>
> My tab characters are 8 columns wide, although some editors made it a
> habit to use tab stops at 4 columns...
>
> I really do not understand the style some people use for blocks:
>
> int ProcessIndex(int iIndex) {
> return iIndex * 3 / 4;
> }
>
>
> It is so ugly and un-intuitive ...
Since you brought it up, I find *your* style extremely ugly and hard
to read. I've seen nothing like it before.
The style you say is ugly and used by "some people" is very common,
and used by people like Stroustrup. (Maybe not for function
definitions like in your example, but for most other blocks.) If you
have problems reading it, learn to. Otherwise you'll have problems
working with just about any other C++ programmer.
For reference, I would have written your code like this:
int main()
{
const int i = 0;
if(i<=10 && i>=-2 && i==0) {
std::cout << "Right result\n";
return 0;
}
::CreateWindow(name, title, style,
x, y,
width, height,
parent);
return 1;
}
(I don't believe in returning -1 from main().)
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: PHP to C++: HipHop for PHP ...thoughts?
http://groups.google.com/group/comp.lang.c++/t/a14b64504ddfa510?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 3:56 pm
From: Brian
On Feb 6, 4:16 pm, Kensai <kens...@gmail.com> wrote:
> On 6/2/2010 8:54 μμ, Brian wrote:
>
> > Southwest Airlines dumped PERL for performance reasons ten
> > years ago and started using C++. I'm not real impressed
> > that Facebook has learned the lesson though. They seem
> > to be coming to C++ kicking and screaming.
>
> C++ is greener as well. Well not according to everyone, but performance
> is always a consideration once your service becomes important.
>
It should be a consideration before a service becomes
popular. If you fail to plan (for success), I think
you plan to fail.
I suggest being ruthless when it comes to scripts
and programs in other languages that someone wants
to write. They look helpful and harmless, but they
turn into monsters overnight if you aren't careful.
You can pay now or pay more later. Facebook like
many others, said in reply, "No thanks." Now
though, they're biting the bullet for their past
ways.
Brian Wood
http://webEbenezer.net
"Where there is no vision, the people perish: but he
that keeps the law, happy is he." Proverbs 29:18
==============================================================================
TOPIC: Why does a vector fail here?
http://groups.google.com/group/comp.lang.c++/t/0f7f65bf6f4a8aa4?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 3:57 pm
From: Jorgen Grahn
On Sun, 2010-01-24, JoeC wrote:
> I am writing a program to display bitmaps and I want to use a vector
> to hold my bitmap data but when I use this algorithm it fails:
>
> for(index = 0; index < dwn; index++){
> memcpy(&temp[((dwn-1) - index)*acc],
> &bitData[index*acc],acc);}
This is completely out of context so I have no idea what you're doing,
but memcpy() is dangerous (and almost always pointless) to use on
anything which may be an object -- for example a std::vector.
(It's also used pointlessly surprisingly often in C code -- I have
lost count of all the complicated memcpy() calls I've replaced
with straight struct assignments over the years.)
...
> Anything else I can add
> to help explain the problem. I often have problems asking questions
> on more complex problems because it can be cumbersome to post from
> several files both .h and .cpp.
http://en.wikipedia.org/wiki/Pastebin
perhaps with the core part of the problem quoted in the posting.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: Motivation of software professionals
http://groups.google.com/group/comp.lang.c++/t/21a3fdec4dd53e6a?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 3:57 pm
From: "Hillbilly"
Which is why I rarely participate as they are ALWAYS FUBAR and BIASED.
"Richard Cornford" <Richard@litotes.demon.co.uk> wrote in message
news:62cdf238-b5ce-4d42-aaa0-1ebe099a01d9@k41g2000yqm.googlegroups.com...
> On Feb 5, 11:19 am, Stefan Kiryazov wrote:
>> Hi all,
>>
>> I am doing a research about motivation in software development,
>> the most efficient practices to motivate software engineers,
>> their popularity, etc.
>
> Strange question; the most efficient motivator of professionals is
> money, and money is very popular.
>
>> As a part of the research, I am doing an online survey for
>> software engineers and managers in software development.
> <snip>
>
> This would be more convincing as an academic exercise, as opposed to,
> say, spam intended to encourage visitors to some web page with the
> intention of gaining advertising revenue, if there were not so many
> advertisements on the page.
>
> In any event, your survey needs the addition of a large number of
> "This question makes no sense" option checkboxes, as it is
> unanswerable as it is.
>
> Richard.
==============================================================================
TOPIC: How to identify the exe file associated with core dump
http://groups.google.com/group/comp.lang.c++/t/ae385d53872a2543?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 4:11 pm
From: Jorgen Grahn
On Mon, 2010-01-25, Vladimir Jovic wrote:
> mthread wrote:
>> Hi,
>> We have multiple applications(C & C++) running in our system. When
>> a core dump is generated we did not know which application caused the
>> core dump. Is there a way to find the application name from the core
>> dump file. Kindly help me on this issue.
>
> See this:
> http://www.sinz.org/Michael.Sinz/Linux/core.html
[Linux kernel patch which lets you control the core dump file name]
Interesting, but in a way not helpful: since the core dump already
contains the process name, making the file name contain it too adds no
information.
Even more offtopic: I find naming core files counter-productive in
practice. If your software is broken and tends to crash, named core
dumps will eventually make someone decide to *disable* core dumps, to
avoid filling the disk. And then you are stuck with no information at
all for your C++ debugging sessions.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
==============================================================================
TOPIC: A design question ....
http://groups.google.com/group/comp.lang.c++/t/50b88a38cf4c0097?hl=en
==============================================================================
== 1 of 2 ==
Date: Sat, Feb 6 2010 4:42 pm
From: forums_mp@hotmail.com
#include <iostream>
#include <typeinfo>
#include <vector>
/// BEGIN "UNTOUCHABLE" CLASSES AND DATA
INSTANTIATORS ///////////////
class base {
public :
//handful of stuff
virtual ~base() {}
};
/*
one of many untouchable pn derived classes with
methods not found in base class
*/
class p1 : public base {
int value ;
public :
p1()
: value ( 0 )
{}
void set_something ( int in ) { value = in ; }
int get_something() const { return ( value ) ; }
~p1() {}
};
class p2 : public base {
public :
//stuff
~p2() {}
};
//up to pn
/// END "UNTOUCHABLE" Pn CLASSES AND DATA
INSTANTIATORS /////////////////
/*
============================================================
holder is a collection of UNTOUCHABLE classes, with useful
member data (For example) 'count'. For each call to Set_ a
phandler will
increment count
*/
typedef unsigned int unsigned_type ;
struct holder {
unsigned_type holder_id ;
unsigned_type count ;
static base *ptr ;
holder ( base *ptr_, unsigned_type const id )
: holder_id ( id )
{
ptr = ptr_;
}
virtual ~holder() { }
};
base* holder::ptr = 0 ;
typedef std::vector < holder* > holder_vec ;
/*
============================================================
base handler for d's.
notified upon receipt of a client message
*/
class d_handler_base {
public :
virtual void process() = 0 ;
virtual ~d_handler_base() {}
};
class d1_handler : public d_handler_base
{
holder_vec hv ;
//only interested in p1 objects located in the holder containers
p1* ptr_p1 ;
public :
d1_handler ( holder_vec& in )
: hv ( in )
//NOTE!!!!!!!!!!!!!!!!!
//ideally i need to use a map so i could interate and FIND p1
//for now we'll assume p1 exists at location 0 within holder_vec
, ptr_p1 ( static_cast < p1* > ( hv [ 0 ]->ptr ) )
{}
void process ()
{
unsigned_type const dummy = ptr_p1->get_something() ;
std::cout << std::hex << "0x" << dummy << std::endl;
}
};
class d2_handler : public d_handler_base
{
public :
d2_handler ()
{}
void process ()
{
std::cout <<"." << std::endl;
}
};
/*
============================================================
base handler for p's.
notified upon receipt of a server message
*/
class p_handler_base {
public :
virtual ~p_handler_base() {}
};
class p1_handler : public p_handler_base
{
holder_vec& hv;
p1* ptr_p1 ;
public :
p1_handler ( holder_vec& in )
: hv ( in )
, ptr_p1 ( static_cast < p1* > ( hv [ 0 ]->ptr ) )
{}
void update_p_msg ( unsigned_type const in ) {
ptr_p1->set_something ( in ) ;
hv [ 0 ]->count ++ ;
}
};
int main() {
static holder_vec hv ;
//this 'new new' stuff seems unsightly... i think a map would be
better....
// for now create a p1 with its id of 0x400, similarily a p2 with
it's id 0x500
hv.push_back ( new holder ( new p1(), 0x400 ) ) ;
hv.push_back ( new holder ( new p2(), 0x500 ) ) ;
d1_handler *ptrd1 = new d1_handler ( hv ) ;
p1_handler *ptrp1 = new p1_handler ( hv ) ;
//change
ptrp1->update_p_msg( 0xCAFE ) ;
ptrd1->process() ;
//change
ptrp1->update_p_msg( 0xDEAD ) ;
ptrd1->process() ;
std::cin.get() ;
}
In a nutshell:
Common message holder class (named holder) with a collection of base
classes. Within main a p1_handler object initiates a change to a p1
object (via the call to set_something). The d1_handler observes the
change.
At this juncture you may say this 'screams' an event handler (perhaps
observer implementation). This way any change to a Pn message by a Pn
handler is dispatched to a Dn handler.
My answer to an event handler (observer implementation) is No!
Here's why: Referencing the d1 and d2 handler classes within source
above:
a) Not all Dn handlers is interested in Pn (UNTOUCHABLE) messages.
For instance, the message holder vec holding Pn messages is a
_dont_care_ for a d2_handler.
b) For those Dn handler interested in Pn messages (i.e d1_handler),
these Dn handlers are not interested in being notified of immediate
changes to Pn messages by Pn handlers. These Dn handlers is only
interested in knowing they have the 'latest' Pn message _whenever_
(600 updates could have occurred since) they access a Pn message
object.
From a development perspective, here's where I'm struggling with in
this case C++. The design and what (perhaps) pattern to use to
achieve the objective. After scanning the GOF here are my thoughts:
1) Leave well enough alone. Current implementation works but then I'm
often not satisfied given my struggles
2) Add a proxy class between the Pn handlers and Dn handlers. I
suspect this would be beneficial to the Dn handlers (more so that Pn
handler since a Pn message could be local to a Pn handler). In doing
so the Dn handler could request via the Proxy for a Pn message and
receive the 'lastest/most up to date' Pn message. The drawback here is
the overhead and (worse) I'm not sure how to implement a proxy (at
least not yet)
3) Perhaps a common base class between Pn handlers and Dn handlers
would suffice.
My question is - is there a better way to do this? Thoughts/ideas
welcomed.
Thanks in advance
== 2 of 2 ==
Date: Sat, Feb 6 2010 4:59 pm
From: "ng2010"
Whoa! That's a lot of code and verbage to be a "design" question! Is
there really no higher-level way to express your "design" issue?
forums_mp@hotmail.com wrote:
> #include <iostream>
> #include <typeinfo>
> #include <vector>
>
> /// BEGIN "UNTOUCHABLE" CLASSES AND DATA
> INSTANTIATORS ///////////////
> class base {
> public :
> //handful of stuff
> virtual ~base() {}
> };
>
> /*
> one of many untouchable pn derived classes with
> methods not found in base class
> */
> class p1 : public base {
> int value ;
> public :
> p1()
> : value ( 0 )
> {}
> void set_something ( int in ) { value = in ; }
> int get_something() const { return ( value ) ; }
> ~p1() {}
> };
>
> class p2 : public base {
> public :
> //stuff
> ~p2() {}
> };
> //up to pn
> /// END "UNTOUCHABLE" Pn CLASSES AND DATA
> INSTANTIATORS /////////////////
>
>
> /*
> ============================================================
> holder is a collection of UNTOUCHABLE classes, with useful
> member data (For example) 'count'. For each call to Set_ a
> phandler will
> increment count
> */
> typedef unsigned int unsigned_type ;
> struct holder {
> unsigned_type holder_id ;
> unsigned_type count ;
> static base *ptr ;
> holder ( base *ptr_, unsigned_type const id )
> : holder_id ( id )
> {
> ptr = ptr_;
> }
> virtual ~holder() { }
> };
> base* holder::ptr = 0 ;
> typedef std::vector < holder* > holder_vec ;
>
> /*
> ============================================================
> base handler for d's.
> notified upon receipt of a client message
> */
> class d_handler_base {
> public :
> virtual void process() = 0 ;
> virtual ~d_handler_base() {}
> };
> class d1_handler : public d_handler_base
> {
> holder_vec hv ;
> //only interested in p1 objects located in the holder containers
> p1* ptr_p1 ;
>
> public :
> d1_handler ( holder_vec& in )
> : hv ( in )
> //NOTE!!!!!!!!!!!!!!!!!
> //ideally i need to use a map so i could interate and FIND p1
> //for now we'll assume p1 exists at location 0 within holder_vec
> , ptr_p1 ( static_cast < p1* > ( hv [ 0 ]->ptr ) )
> {}
> void process ()
> {
> unsigned_type const dummy = ptr_p1->get_something() ;
> std::cout << std::hex << "0x" << dummy << std::endl;
> }
> };
> class d2_handler : public d_handler_base
> {
> public :
> d2_handler ()
> {}
> void process ()
> {
> std::cout <<"." << std::endl;
> }
> };
>
> /*
> ============================================================
> base handler for p's.
> notified upon receipt of a server message
> */
> class p_handler_base {
> public :
> virtual ~p_handler_base() {}
> };
> class p1_handler : public p_handler_base
> {
> holder_vec& hv;
> p1* ptr_p1 ;
>
> public :
> p1_handler ( holder_vec& in )
> : hv ( in )
> , ptr_p1 ( static_cast < p1* > ( hv [ 0 ]->ptr ) )
> {}
> void update_p_msg ( unsigned_type const in ) {
> ptr_p1->set_something ( in ) ;
> hv [ 0 ]->count ++ ;
> }
> };
>
>
> int main() {
> static holder_vec hv ;
> //this 'new new' stuff seems unsightly... i think a map would be
> better....
> // for now create a p1 with its id of 0x400, similarily a p2 with
> it's id 0x500
> hv.push_back ( new holder ( new p1(), 0x400 ) ) ;
> hv.push_back ( new holder ( new p2(), 0x500 ) ) ;
>
> d1_handler *ptrd1 = new d1_handler ( hv ) ;
> p1_handler *ptrp1 = new p1_handler ( hv ) ;
> //change
> ptrp1->update_p_msg( 0xCAFE ) ;
> ptrd1->process() ;
>
> //change
> ptrp1->update_p_msg( 0xDEAD ) ;
> ptrd1->process() ;
>
>
> std::cin.get() ;
>
> }
>
> In a nutshell:
>
> Common message holder class (named holder) with a collection of base
> classes. Within main a p1_handler object initiates a change to a p1
> object (via the call to set_something). The d1_handler observes the
> change.
>
> At this juncture you may say this 'screams' an event handler (perhaps
> observer implementation). This way any change to a Pn message by a Pn
> handler is dispatched to a Dn handler.
>
> My answer to an event handler (observer implementation) is No!
> Here's why: Referencing the d1 and d2 handler classes within source
> above:
>
> a) Not all Dn handlers is interested in Pn (UNTOUCHABLE) messages.
> For instance, the message holder vec holding Pn messages is a
> _dont_care_ for a d2_handler.
>
> b) For those Dn handler interested in Pn messages (i.e d1_handler),
> these Dn handlers are not interested in being notified of immediate
> changes to Pn messages by Pn handlers. These Dn handlers is only
> interested in knowing they have the 'latest' Pn message _whenever_
> (600 updates could have occurred since) they access a Pn message
> object.
>
> From a development perspective, here's where I'm struggling with in
> this case C++. The design and what (perhaps) pattern to use to
> achieve the objective. After scanning the GOF here are my thoughts:
>
> 1) Leave well enough alone. Current implementation works but then I'm
> often not satisfied given my struggles
> 2) Add a proxy class between the Pn handlers and Dn handlers. I
> suspect this would be beneficial to the Dn handlers (more so that Pn
> handler since a Pn message could be local to a Pn handler). In doing
> so the Dn handler could request via the Proxy for a Pn message and
> receive the 'lastest/most up to date' Pn message. The drawback here is
> the overhead and (worse) I'm not sure how to implement a proxy (at
> least not yet)
> 3) Perhaps a common base class between Pn handlers and Dn handlers
> would suffice.
>
> My question is - is there a better way to do this? Thoughts/ideas
> welcomed.
>
> Thanks in advance
==============================================================================
TOPIC: PODs, Constructors and the Boost uuid Class
http://groups.google.com/group/comp.lang.c++/t/a115833b71eecd59?hl=en
==============================================================================
== 1 of 2 ==
Date: Sat, Feb 6 2010 5:03 pm
From: "ng2010"
From http://www.boost.org/doc/libs/1_42_0/libs/uuid/uuid.html and in the
section titled "POD Efficiencies", they give a workaround to the
defficiency/oversight in C++ that a POD cannot have constructors:
class uuid_class : public boost::uuids::uuid
{
public:
uuid_class() // def ctor shouldn't auto gen IMO else this
// class should be called auto_uuid or something
: boost::uuids::uuid(boost::uuids::random_generator()())
{}
explicit uuid_class(boost::uuids::uuid const& u)
: boost::uuids::uuid(u)
{}
operator boost::uuids::uuid() {
return static_cast<boost::uuids::uuid&>(*this);
}
operator boost::uuids::uuid() const {
return static_cast<boost::uuids::uuid const&>(*this);
}
};
What I don't understand is why the conversion operators in uuid_class
above guarantee anything more than just having defined boost::uuids::uuid
as a class with the constructors given above. The conversion operators
for the operators are just casting *this. Why the operators at all when
uuid_class IS a uuid?
== 2 of 2 ==
Date: Sat, Feb 6 2010 10:10 pm
From: "Alf P. Steinbach"
* ng2010:
> From http://www.boost.org/doc/libs/1_42_0/libs/uuid/uuid.html and in the
> section titled "POD Efficiencies", they give a workaround to the
> defficiency/oversight in C++ that a POD cannot have constructors:
>
> class uuid_class : public boost::uuids::uuid
> {
> public:
> uuid_class() // def ctor shouldn't auto gen IMO else this
> // class should be called auto_uuid or something
No, that would be unsound design. There is already the POD class if you want an
uninitialized UUID instance. This class would serve no purpose if did nothing. :-)
> : boost::uuids::uuid(boost::uuids::random_generator()())
> {}
>
> explicit uuid_class(boost::uuids::uuid const& u)
> : boost::uuids::uuid(u)
> {}
>
> operator boost::uuids::uuid() {
> return static_cast<boost::uuids::uuid&>(*this);
> }
>
> operator boost::uuids::uuid() const {
> return static_cast<boost::uuids::uuid const&>(*this);
> }
> };
>
> What I don't understand is why the conversion operators in uuid_class
> above guarantee anything more than just having defined boost::uuids::uuid
> as a class with the constructors given above. The conversion operators
> for the operators are just casting *this. Why the operators at all when
> uuid_class IS a uuid?
It appears to be meaningless.
With Boost stuff one can never say for sure because those guys are very very
heavily into SFINAE and other subtle template metaprogramming magic and other
at-the-very-front-edge things (I think that's a problem with Boost), but at
least for ordinary programming it's meaningless to have the operators above.
But notwithstanding my comment about Boost intricacies I'm fairly sure that it's
an error, perhaps something left from an earlier version with private
inheritance, because this class lacks an assignment operator that directly takes
a POD argument, and although it will work without it (via value conversion)
that's inefficient so if this example had been quality checked then that
assignment operator would have been there, so, it's not been checked.
Cheers & hth.,
- Alf
==============================================================================
TOPIC: Static const variables cause linker problems under Qt
http://groups.google.com/group/comp.lang.c++/t/f7acbdcaf443120e?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 5:13 pm
From: Yu Han
On 02/05/2010 11:24 PM, Rune Allnor wrote:
> Hi all.
>
> I have a template class where I have defined some
> constants in a header file, along the lines of
>
> ////////////////////////////////////////////
> class flags{
> static const size_t flag;
> };
>
> const size_t flags::flag = 1;
> ////////////////////////////////////////////
try this:
class flags {
static const size_t flag = 1;
};
>
> This compiles and runs nicely in the Boost.Test program,
> but when I try to use the template class in a Qt GUI program,
> the linker starts complaining about the constants as being
> multiple defined objects:
>
> - in main.obj
> - in moc_myfile.obj
> - in myfile.obj
>
> I have included the standard guard about multiple inclucions
> of the header files, and I can see why these constants would
> appear in myfile.obj, as I include the file where they are declared
> from myfile.h. However, I have no idea why the constants should
> be available in main.obj or moc-myfile.obj - that's where Qt come
> in to do its thing.
>
> There isn't much I can do about the ways Qt twists and turns
> the code into an executable, so I suppose my only hope
> is to be able to resolve the 'multiple definition' problem.
>
> Any hints on how to do this?
>
> The flags class will exist in millions of instances, so I can not
> afford to include the flag definintions as const variables in the
> class.
>
> Rune
--
Yu Han
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
==============================================================================
TOPIC: ===Welcome to comp.lang.c++! Read this first.
http://groups.google.com/group/comp.lang.c++/t/a801c2fa8f66c0a0?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 9:30 pm
From: Shiva
Welcome to comp.lang.c++! Read this first.
This post is intended to give the new reader an introduction to reading
and posting in this newsgroup. We respectfully request that you read
all the way through this post, as it helps make for a more pleasant
and useful group for everyone.
First of all, please keep in mind that comp.lang.c++ is a group for discussion
of general issues of the C++ programming language, as defined by the ANSI/ISO
language standard. If you have a problem that is specific to a particular system
or compiler, you are much more likely to get complete and accurate answers in a
group that specializes in your platform. A listing of some newsgroups is given
at the end of this post.
The FAQ (Frequently Asked Question) list has a wealth of information for
both the new and veteran C++ programmer. No matter what your experience
level, you are encouraged to read the entire list, if only to familiarize
yourself with what answers are available to minimize redundant replies.
The comp.lang.c++ FAQ is available at http://www.parashift.com/c++-faq-lite/
If the FAQ list does not help, then many regular readers of this group
are happy to assist with problems of standard C++. We have only a few
requests that we ask be adhered to, for the benefit of all:
* Please put a short summary in the subject line. Descriptions such as
"HELP!!!!!!" are not helpful, and many regular posters ignore such
requests. A good example is, "Problem with Virtual Functions."
* State the question or the problem clearly and concisely. Describe what
you are trying to do, and the problem you are running into. Include all
relevant error messages.
* Include the smallest, complete and compilable program that exhibits your
problem. As a rule, posters in comp.lang.c++ will not do homework, but will
give helpful hints if you have shown some willingness to try a solution.
* comp.lang.c++ is forum for discussion, and as such some regular posters do
not give E-mail replies. Very often follow-ups to postings have corrections,
so plan on taking part in the discussion if you post a question. If you
do receive e-mail replies, it is considered polite to post a summary.
* Don't post in HTML format. Many readers of this newsgroup don't use
newsreaders which can handle HTML postings.
* If you have to include source code in your post, include the
source in the message body. Don't use attachments. A lot
of contributors to this newsgroup won't even notice the existence
of attachments or won't open them. You try to get any help
you can get, don't you?
Some netiquette topics which frequently crop up on comp.lang.c++ are
also answered in the FAQ.
* Should I post job advertisements and/or resumes on comp.lang.c++?
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.10
* What if I really need a job; should I post my resume on comp.lang.c++?
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.11
* What should I do to someone who posts something off-topic?
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.12
A note on comp.lang.c++ etiquette: Accuracy is valued very highly in this
newsgroup; therefore posts are frequently corrected, sometimes perhaps
too harshly, and often to the annoyance of new posters who consider the
correction trivial. Do not take it personally; the best way to fit in
with comp.lang.c++ is to express gratitude for the correction, move on,
and be more careful next time.
This is a very busy group, so these requests are designed to make it as
pleasant and efficient an experience as possible. We hope it proves
a valuable commodity to you.
A list of some Newsgroups :
Languages and Programming
-------------------------
comp.lang.c The C Programming Language
comp.lang.asm.x86 x86 assembly language programming
comp.programming Non-language specific programming
comp.graphics.algorithms Issues of computer graphics
Operating Systems
-----------------
comp.os.msdos.programmer DOS, BIOS, Memory Models, interrupts,
screen handling, hardware
comp.os.ms-windows.programmer.win32 MS/Windows: Mice, DLLs, hardware
comp.os.os2.programmer.misc OS/2 Programming
comp.sys.mac.programmer.misc Macintosh Programming
comp.unix.programmer General Unix: processes, pipes, POSIX,
curses, sockets
comp.unix.[vendor] Various Unix vendors
Microsoft VC++
-------------
microsoft.public.vc.language VC++ issues
microsoft.public.vc.mfc MFC Issues
microsoft.public.dotnet.languages.vc C++/CLR Issues
microsoft.public.dotnet.framework .Net Framework
Borland C++ Builder
-------------------
borland.public.cppbuilder.language Borland C++ Builder
borland.public.cpp.language
borland.public.cppbuilder
-Shiva
http://www.slack.net/~shiva/welcome.txt
Sun Feb 7 00:30:00 EST 2010
==============================================================================
TOPIC: paypal wholesale Puma (paypal payment)(www.globlepurchase.com)
http://groups.google.com/group/comp.lang.c++/t/47a934a1b114096e?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 9:57 pm
From: brandtrade
Ebel Watch wholesale (paypal payment) (www.globlepurchase.com)
Bape Watch wholesale (paypal payment) (www.globlepurchase.com)
Bell&Ross Watch wholesale (paypal payment) (www.globlepurchase.com)
Breit Ling Watch wholesale (paypal payment) (www.globlepurchase.com)
Burberry Watch wholesale (paypal payment) (www.globlepurchase.com)
Cartier Watch wholesale (paypal payment) (www.globlepurchase.com)
Chopard Watch wholesale (paypal payment) (www.globlepurchase.com)
D&G Watch wholesale (paypal payment) (www.globlepurchase.com)
Givenchy Watch wholesale (paypal payment) (www.globlepurchase.com)
Jacob&Co Watch wholesale (paypal payment) (www.globlepurchase.com)
Kappa Watch wholesale (paypal payment) (www.globlepurchase.com)
Prada Watch wholesale (paypal payment) (www.globlepurchase.com)
Tissot Watch wholesale (paypal payment) (www.globlepurchase.com)
Titoni Watch wholesale (paypal payment) (www.globlepurchase.com)
U-BOAT Watch wholesale (paypal payment) (www.globlepurchase.com)
Zenith Watch wholesale (paypal payment) (www.globlepurchase.com)
A.Lange&Sohne Watch wholesale (paypal payment)
(www.globlepurchase.com)
Audemars Piguet Watch wholesale (paypal payment)
(www.globlepurchase.com)
Baume&Mercier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Blancpain Watch wholesale (paypal payment) (www.globlepurchase.com)
Breguet Watch wholesale (paypal payment) (www.globlepurchase.com)
BRM Watch wholesale (paypal payment) (www.globlepurchase.com)
Bvlgari Watch wholesale (paypal payment) (www.globlepurchase.com)
Chanel Watch wholesale (paypal payment) (www.globlepurchase.com)
Concord Watch wholesale (paypal payment) (www.globlepurchase.com)
Corum Watch wholesale (paypal payment) (www.globlepurchase.com)
Dewitt Watch wholesale (paypal payment) (www.globlepurchase.com)
Ferrari Watch wholesale (paypal payment) (www.globlepurchase.com)
Franck Muller Watch wholesale (paypal payment)
(www.globlepurchase.com)
Girard Perregaux Watch (paypal payment) (www.globlepurchase.com)
Glashutte Watch (paypal payment) (www.globlepurchase.com)
Graham Watch wholesale (paypal payment) (www.globlepurchase.com)
GUCCI Watch wholesale (paypal payment) (www.globlepurchase.com)
GUESS Watch wholesale (paypal payment) (www.globlepurchase.com)
Hamilton Watch wholesale (paypal payment) (www.globlepurchase.com)
Hermes Watch wholesale (paypal payment) (www.globlepurchase.com)
Hublot Watch wholesale (paypal payment) www.globlepurchase.com)
IWC Watch wholesale (paypal payment) (www.globlepurchase.com)
Jaeger Le Coultre Watch wholesale (paypal payment)
(www.globlepurchase.com)
Longines Watch wholesale (paypal payment) (www.globlepurchase.com)
LV Watch wholesale (paypal payment) (www.globlepurchase.com)
Montblanc Watch wholesale (paypal payment) (www.globlepurchase.com)
Movado Watch wholesale (paypal payment) (www.globlepurchase.com)
Omega Watch wholesale (paypal payment) (www.globlepurchase.com)
Oris Watch wholesale (paypal payment) (www.globlepurchase.com)
Paket Philippe Watch wholesale (paypal payment)
(www.globlepurchase.com)
Panerai Watch wholesale (paypal payment) (www.globlepurchase.com)
Parmigiani Fleurier Watch wholesale (paypal payment)
(www.globlepurchase.com)
Piaget Watch wholesale (paypal payment) (www.globlepurchase.com)
Porsche Design Watch wholesale (paypal payment)
(www.globlepurchase.com)
Rolex Watch wholesale (paypal payment) (www.globlepurchase.com)
Romain Jerome Titanic-Dna Watch wholesale (paypal payment)
(www.globlepurchase.com)
Tag Heuer Watch wholesale (paypal payment) (www.globlepurchase.com)
Tudor Watch wholesale (paypal payment) (www.globlepurchase.com)
Vach.Constantine Watch wholesale (paypal payment)
(www.globlepurchase.com)
Armani Watch wholesale (paypal payment) (www.globlepurchase.com)
RADO Watch wholesale (paypal payment) (www.globlepurchase.com)
paypal wholesale d&g shoes (paypal payment)(www.globlepurchase.com)
paypal wholesale gucci shoes (paypal payment)(www.globlepurchase.com)
paypal wholesale lv shoes (paypal payment)( www.globlepurchase.com)
paypal wholesale NBA shoes (paypal payment)(www.globlepurchase.com)
paypal wholesale nike (paypal payment)(www.globlepurchase.com)
paypal wholesale adidas shoes (paypal payment)
(www.globlepurchase.com)
paypal wholesale UGG shoes (paypal payment)(www.globlepurchase.com)
paypal wholesale bape hoody (paypal payment)(www.globlepurchase.com)
paypal wholesale antick jeans (paypal payment)
(www.globlepurchase.com)
paypal wholesale diesel jeans (paypal payment)
(www.globlepurchase.com)
paypal wholesale artful dudger (paypal payment)
(www.globlepurchase.com)
paypal wholesale bag(lv gucci coach chanel d&g dior ed fendi )
(paypal payment)( www.globlepurchase.com)
paypal wholesale clothing (paypal payment)(www.globlepurchase.com)
paypal wholesale lrg,jeans,hoody, (paypal payment)
(www.globlepurchase.com)
paypal wholesale evisu jeans,hoody,shirt (paypal payment)
(www.globlepurchase.com)
paypal wholesale Prada (paypal payment)(www.globlepurchase.com)
paypal wholesale Puma (paypal payment)(www.globlepurchase.com)
paypal wholesale Sand (paypal payment)(www.globlepurchase.com)
paypal wholesale Shox (paypal payment)(www.globlepurchase.com)
paypal wholesale soccer (paypal payment)(www.globlepurchase.com)
paypal wholesale UGG (paypal payment)(www.globlepurchase.com)
paypal wholesale Versace (paypal payment)(www.globlepurchase.com)
paypal wholesale Women (paypal payment)(www.globlepurchase.com)
paypal wholesale Y-3 (paypal payment)(www.globlepurchase.com)
==============================================================================
You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.
To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en
To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com
To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en
To report abuse, send email explaining the problem to abuse@googlegroups.com
==============================================================================
Google Groups: http://groups.google.com/?hl=en
No comments:
Post a Comment