http://groups.google.com/group/comp.lang.c++?hl=en
comp.lang.c++@googlegroups.com
Today's topics:
* Motivation of software professionals - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/21a3fdec4dd53e6a?hl=en
* ♣(=@__@=)♣Hot sale cheap bed sheet, umbrella, crimping iron, Bose at www.
ecyaya.com - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/54b92034ade6261c?hl=en
* 。◕‿◕。 2010 Cheap wholesale brand jeans: True Relig Jean, Laguna Beach Jean,
G-star Jean, Armani Jean ect at http://www.rijing-trade.com <Paypal Payment> -
1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/728b2af97cc034ba?hl=en
* Google AI Challenge at U of Waterloo - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/40f30c405afc24ab?hl=en
* PHP to C++: HipHop for PHP ...thoughts? - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/a14b64504ddfa510?hl=en
* OpenMP and functors - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/69a3ea80ba0eb730?hl=en
* Why A Big Difference between C++98 and C++0x on a local type as a template-
argument? - 6 messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/2c411d40c5c4017e?hl=en
* Incomplete types and std::vector - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/b0741c38fc15b5f7?hl=en
* ❉♡❉nike shox | nike shox r4 | nike shox r5 | nike shox r3 | nike shox in www.
ecyaya.com - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/352bfbaa4ee5f838?hl=en
* Loop generates never-ending sockets and threads, need help debugging - 2
messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/bfb43e94d5fe70d1?hl=en
==============================================================================
TOPIC: Motivation of software professionals
http://groups.google.com/group/comp.lang.c++/t/21a3fdec4dd53e6a?hl=en
==============================================================================
== 1 of 1 ==
Date: Fri, Feb 5 2010 11:39 pm
From: Roedy Green
On Fri, 5 Feb 2010 04:23:41 -0800 (PST), Richard Cornford
<Richard@litotes.demon.co.uk> wrote, quoted or indirectly quoted
someone who said :
>
>Strange question; the most efficient motivator of professionals is
>money, and money is very popular.
That may be a motivator for taking a job, but I suspect is fairly far
down the list for leaving a job.
Leaving motivations might include:
personality conflict
boredom
too much pressure
Personally, the opportunity to do something I had never done before
was always the top priority. Employers usually want people who have
extensive specific experience.
In hiring, my main interest was loyalty. Employees don't get really
useful until after the first year. I don't expect them to hit the
ground running. I anticipate investing considerable effort in training
them. I looked for reasons why they would likely want to stay.
--
Roedy Green Canadian Mind Products
http://mindprod.com
You can't have great software without a great team, and most software teams behave like dysfunctional families.
~ Jim McCarthy
==============================================================================
TOPIC: ♣(=@__@=)♣Hot sale cheap bed sheet, umbrella, crimping iron, Bose at
www.ecyaya.com
http://groups.google.com/group/comp.lang.c++/t/54b92034ade6261c?hl=en
==============================================================================
== 1 of 2 ==
Date: Sat, Feb 6 2010 12:33 am
From: hero
♣(=@__@=)♣Hot sale cheap bed sheet, umbrella, crimping iron, Bose at
www.ecyaya.com
Hot sale cheap LV 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap Gucci 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap Fendi 4 sets in a bag at www.ecyaya.com
Hot sale cheap Dior 4 sets in a bag at www.ecyaya.com
Hot sale cheap Coach 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap CK 4 set bed in a bag at www.ecyaya.com
Hot sale cheap Chanel 4 sets in a bag at www.ecyaya.com
Hot sale cheap Burberry 4 sets in a bag at www.ecyaya.com
Hot sale cheap LV6 sets bed in a bag at www.ecyaya.com
Hot sale cheap Gucci 6 sets bed in a bag at www.ecyaya.com
Hot sale cheap Fendi 6 sets in a bag at www.ecyaya.com
Hot sale cheap Dior 6 sets in a bag at www.ecyaya.com
Hot sale cheap Coach 6 sets bed in a bag at www.ecyaya.com
Hot sale cheap CK 6 set bed in a bag at www.ecyaya.com
Hot sale cheap Chanel 6 sets in a bag at www.ecyaya.com
Hot sale cheap Burberry 6 sets in a bag at www.ecyaya.com
Hot sale cheap Umbella at www.ecyaya.com
Hoe sale cheap Bose at www.ecyaya.com
Hot sale cheap crimping iron at www.ecyaya.com
Welcome to my website www.ecyaya.com for more details, the bedsheet
have different styles, different colors for your reference.
== 2 of 2 ==
Date: Sat, Feb 6 2010 12:32 am
From: hero
♣(=@__@=)♣Hot sale cheap bed sheet, umbrella, crimping iron, Bose at
www.ecyaya.com
Hot sale cheap LV 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap Gucci 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap Fendi 4 sets in a bag at www.ecyaya.com
Hot sale cheap Dior 4 sets in a bag at www.ecyaya.com
Hot sale cheap Coach 4 sets bed in a bag at www.ecyaya.com
Hot sale cheap CK 4 set bed in a bag at www.ecyaya.com
Hot sale cheap Chanel 4 sets in a bag at www.ecyaya.com
Hot sale cheap Burberry 4 sets in a bag at www.ecyaya.com
Hot sale cheap LV6 sets bed in a bag at www.ecyaya.com
Hot sale cheap Gucci 6 sets bed in a bag at www.ecyaya.com
Hot sale cheap Fendi 6 sets in a bag at www.ecyaya.com
Hot sale cheap Dior 6 sets in a bag at www.ecyaya.com
Hot sale cheap Coach 6 sets bed in a bag at www.ecyaya.com
Hot sale cheap CK 6 set bed in a bag at www.ecyaya.com
Hot sale cheap Chanel 6 sets in a bag at www.ecyaya.com
Hot sale cheap Burberry 6 sets in a bag at www.ecyaya.com
Hot sale cheap Umbella at www.ecyaya.com
Hoe sale cheap Bose at www.ecyaya.com
Hot sale cheap crimping iron at www.ecyaya.com
Welcome to my website www.ecyaya.com for more details, the bedsheet
have different styles, different colors for your reference.
==============================================================================
TOPIC: 。◕‿◕。 2010 Cheap wholesale brand jeans: True Relig Jean, Laguna Beach
Jean, G-star Jean, Armani Jean ect at http://www.rijing-trade.com <Paypal
Payment>
http://groups.google.com/group/comp.lang.c++/t/728b2af97cc034ba?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 12:47 am
From: "www.fjrjtrade.com"
。◕‿◕。 2010 Cheap wholesale brand jeans: True Relig Jean, Laguna Beach
Jean, G-star Jean, Armani Jean ect at www.rijing-trade.com <Paypal
Payment>
Cheap wholesale Jeans
Cheap wholesale A&F Jean
Cheap wholesale Artful Dodger Jean
Cheap wholesale BBC Jean
Cheap wholesale Cavalli Jean
Cheap wholesale Iceberg Jean Man
Cheap wholesale Kanji Jean Man
Cheap wholesale Laguna Beach Jean
Cheap wholesale Michael Jackson Jean Man
Cheap wholesale Prada Jean
Cheap wholesale RMC Jean
Cheap wholesale Robins Jean Man
Cheap wholesale Roca Wear Jean
Cheap wholesale ZEN Jean
Cheap wholesale Affliction Jean
Cheap wholesale Akademiks Jean
Cheap wholesale Armani Jean
Cheap wholesale Bape Jean
Cheap wholesale Christian Audigier Jean
Cheap wholesale Coogi Jean
Cheap wholesale Crown Holder Jean
Cheap wholesale D&G Jean
Cheap wholesale Diesel Jean
Cheap wholesale Ecko Unltd Jean
Cheap wholesale Ed Hardy Jean
Cheap wholesale Evisu Jean
Cheap wholesale G-Star Jean
Cheap wholesale Gucci Jean
Cheap wholesale LEVI'S Jean
Cheap wholesale LRG Jean
Cheap wholesale LV Jean
Cheap wholesale Rock Jean
Cheap wholesale True Relig Jean
Cheap wholesale Versace Jean
More items at website:
http://www.rijing-trade.com
==============================================================================
TOPIC: Google AI Challenge at U of Waterloo
http://groups.google.com/group/comp.lang.c++/t/40f30c405afc24ab?hl=en
==============================================================================
== 1 of 4 ==
Date: Sat, Feb 6 2010 1:40 am
From: Jeff Cameron
On Feb 5, 11:18 pm, "Man-wai Chang to The Door (24000bps)"
<toylet.toy...@gmail.com> wrote:
> On 06-Feb-10 08:02, Forthminder wrote:
>
> > Contest runs from 4 February to 26 February 2010.
> >http://csclub.uwaterloo.ca/contest/problem_description.php
> > Bonne Chance!
>
> It's definitely *not* exactly a programming challenge, but algorithm
> challenge.
>
> A programming (only) challenge should only require the players to write
> codes to implement an algorithm.
>
> This one requires both algorithm design & programming.
>
> --
> @~@ Might, Courage, Vision, SINCERITY.
> / v \ Simplicity is Beauty! May the Force and Farce be with you!
> /( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
> ^ ^ 12:16:01 up 6 days 20:22 2 users load average: 0.45 0.26 0.09
> 不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
Hello, this is Jeff Cameron, the organizer of the Google AI Challenge.
I'm glad to see all this interest in our humble little contest. I wish
you all the best of luck, and encourage everyone to try their hand at
writing an AI for Tron! www.ai-contest.com
== 2 of 4 ==
Date: Sat, Feb 6 2010 1:45 am
From: Paul Rubin
"Man-wai Chang to The Door (24000bps)" <toylet.toylet@gmail.com> writes:
> It's definitely *not* exactly a programming challenge, but algorithm
> challenge.
> A programming (only) challenge should only require the players to
> write codes to implement an algorithm.
Eh? Just about every interesting programming challenge is mostly about
algorithm selection. Try some Project Euler for example.
== 3 of 4 ==
Date: Sat, Feb 6 2010 5:41 am
From: "Man-wai Chang to The Door (24000bps)"
> Eh? Just about every interesting programming challenge is mostly about
> algorithm selection. Try some Project Euler for example.
Everyone back then has abused the "programming" word to meant doing
everything (algorithms (system analysis & design), data structures,
coding, testing, documentation, auditing, ....) at cheap
salaries+benefits and tight schedules!
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 21:40:01 up 7 days 5:46 2 users load average: 0.00 0.04 0.01
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
== 4 of 4 ==
Date: Sat, Feb 6 2010 5:43 am
From: "Man-wai Chang to The Door (24000bps)"
> Hello, this is Jeff Cameron, the organizer of the Google AI Challenge.
> I'm glad to see all this interest in our humble little contest. I wish
> you all the best of luck, and encourage everyone to try their hand at
> writing an AI for Tron! www.ai-contest.com
Someone please dumb the Tron ROM from the MAME32 project and use it as
baseline answer. :)
--
@~@ Might, Courage, Vision, SINCERITY.
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (x86_64 Ubuntu 9.10) Linux 2.6.32.7
^ ^ 21:42:01 up 7 days 5:48 2 users load average: 0.00 0.02 0.00
不借貸! 不詐騙! 不援交! 不打交! 不打劫! 不自殺! 請考慮綜援 (CSSA):
http://www.swd.gov.hk/tc/index/site_pubsvc/page_socsecu/sub_addressesa
==============================================================================
TOPIC: PHP to C++: HipHop for PHP ...thoughts?
http://groups.google.com/group/comp.lang.c++/t/a14b64504ddfa510?hl=en
==============================================================================
== 1 of 5 ==
Date: Sat, Feb 6 2010 1:40 am
From: nick
Developers over at Facebook are getting ready to release a PHP to C++
code converter, dubbed 'HipHop' (HPHP). The reaction has been positive
on the PHP side; although this really only benefits large-scale web
apps ATM, it may already be influencing the direction the PHP language
spec will take, and I could see it breathing some new life into the C+
+ community as well (read: jobs (as C++ programmers)). I'd love to
hear this group's thoughts on this!
http://developers.facebook.com/news.php?blog=1&story=358
== 2 of 5 ==
Date: Sat, Feb 6 2010 9:33 am
From: "Ira Baxter"
"nick" <nick___@fastmail.fm> wrote in message
news:b0921cc0-c6dd-4a90-bb28-d75bea8d3d70@u41g2000yqe.googlegroups.com...
> Developers over at Facebook are getting ready to release a PHP to C++
> code converter, dubbed 'HipHop' (HPHP). The reaction has been positive
> on the PHP side; although this really only benefits large-scale web
> apps ATM, it may already be influencing the direction the PHP language
> spec will take, and I could see it breathing some new life into the C+
> + community as well (read: jobs (as C++ programmers)). I'd love to
> hear this group's thoughts on this!
>
> http://developers.facebook.com/news.php?blog=1&story=358
HipHop is *just* a compiler that happens to emit C++.
They could have emitted C and probably done just about as well if not
better.
Lots of compilers have been built over the years that generate
C or C++ as output in the name of portability (really in the name
of avoiding generation of a backend for target machines).
IMHO, what a compiler emits as a target doesn't "breathe life" into the
target.
It makes PHP somewhat more interesting, agreed, in that it
helps to serve Facebook and Yahoo at their scale.
--
Ira Baxter, CTO
www.semanticdesigns.com
== 3 of 5 ==
Date: Sat, Feb 6 2010 11:54 am
From: Brian
On Feb 6, 3:40 am, nick <nick...@fastmail.fm> wrote:
> Developers over at Facebook are getting ready to release a PHP to C++
> code converter, dubbed 'HipHop' (HPHP). The reaction has been positive
> on the PHP side; although this really only benefits large-scale web
> apps ATM, it may already be influencing the direction the PHP language
> spec will take, and I could see it breathing some new life into the C+
> + community as well (read: jobs (as C++ programmers)). I'd love to
> hear this group's thoughts on this!
>
> http://developers.facebook.com/news.php?blog=1&story=358
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.
Brian Wood
http://webEbenezer.net
(651) 251-9384
== 4 of 5 ==
Date: Sat, Feb 6 2010 12:01 pm
From: nick
On Feb 6, 12:33 pm, "Ira Baxter" <idbax...@semdesigns.com> wrote:
> "nick" <nick...@fastmail.fm> wrote in message
>
> news:b0921cc0-c6dd-4a90-bb28-d75bea8d3d70@u41g2000yqe.googlegroups.com...
>
> > Developers over at Facebook are getting ready to release a PHP to C++
> > code converter, dubbed 'HipHop' (HPHP). The reaction has been positive
> > on the PHP side; although this really only benefits large-scale web
> > apps ATM, it may already be influencing the direction the PHP language
> > spec will take, and I could see it breathing some new life into the C+
> > + community as well (read: jobs (as C++ programmers)). I'd love to
> > hear this group's thoughts on this!
>
> >http://developers.facebook.com/news.php?blog=1&story=358
>
> HipHop is *just* a compiler that happens to emit C++.
> They could have emitted C and probably done just about as well if not
> better.
> Lots of compilers have been built over the years that generate
> C or C++ as output in the name of portability (really in the name
> of avoiding generation of a backend for target machines).
>
> IMHO, what a compiler emits as a target doesn't "breathe life" into the
> target.
> It makes PHP somewhat more interesting, agreed, in that it
> helps to serve Facebook and Yahoo at their scale.
>
> --
> Ira Baxter, CTOwww.semanticdesigns.com
The "life-breathing" part was in reference to all the PHP libraries
that need to be converted to C++ now for this to work... they have to
be converted manually. So if ext_mysql has already been converted but
ext_pgsql has not, and some large site is using pgsql and wants to use
HipHop, there's some C++ code waiting to be written.
Another thing I could possibly see happening is HPHP evolving to the
point where views can be written in PHP and (to borrow some .NET
terminology) the "code behind" the view could be written in C++, in
the same way .NET uses ASPX for the view and C# for the "code behind."
It's probably too early to tell if this is a realistic scenario, but I
could really see something like this creating some new work for C++
developers, giving web devs a reason to learn/use C++ in the first
place, etc.
== 5 of 5 ==
Date: Sat, Feb 6 2010 2:16 pm
From: Kensai
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.
http://www.webtoolkit.eu/wt#/blog/2009/12/17/facebook__php__is_not_very_kopenhagen/more
==============================================================================
TOPIC: OpenMP and functors
http://groups.google.com/group/comp.lang.c++/t/69a3ea80ba0eb730?hl=en
==============================================================================
== 1 of 2 ==
Date: Sat, Feb 6 2010 2:56 am
From: Robert Fendt
Hi,
I am currently trying to parallelise an image transformation loop. The transformations are arbitrary and performed consecutively, so they currently are kept in a vector of functor pointers. A much simplified version looks like this (syntax errors and typos notwithstanding):
class FunctorBase
{
virtual void get_coord(double& x, double&y) = 0;
};
class Transform
{
public:
void transform()
{
#pragma omp parallel for
for (size_t j = 0; j < lines; ++j)
{
for (size_t i = 0; i < lines; ++i)
{
...
get_coord(x, y);
...
}
}
}
private:
void get_coord(double& x, double&)
{
for (size_t i = 0; i < n_func_; ++i)
{
func_[i]->get_coord(x, y);
}
}
private:
std::vector<FunctorBase*> func_;
size_t n_func_;
};
If I allow more than one thread, the result is garbled (for OMP_NUM_THREADS==1, everything is fine), though I do not really understand why. The transformation functors do not use ugly stuff like static variables or similar, and I always thought it was save to call a method in the same object from different threads, _provided_ one does not change the object state (i.e., all member variables are untouched).
So: what do I do? I can wrap the transformation list in a separate class and implement a copy constructor for it, which would enable me to put a thread-private instance of it on the stack. But this is quite a lot of overhead, so I was hoping that maybe I am not seeing the wood for the trees here (i.e., overlooking the obvious).
Regards,
Robert
== 2 of 2 ==
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: Why A Big Difference between C++98 and C++0x on a local type as a
template-argument?
http://groups.google.com/group/comp.lang.c++/t/2c411d40c5c4017e?hl=en
==============================================================================
== 1 of 6 ==
Date: Sat, Feb 6 2010 4:13 am
From: xmllmx
Dear all,
C++98 14.3.1 explicitly says as follows:
"A local type, a type with no linkage, an unnamed type or a type
compunded from any of these types shall not be used as a template-
argument for a template type-parameter."
And the Standard also immediately gives an example:
/*-- Source Code Begin --*/
template <class T> class X {};
void f()
{
struct S {};
X<S> x3; // error: local type used as template-argument
}
/*-- Source Code End --*/
Nevertheless, the source code should can be correctly compiled by
Visual C++. Moreover, C++0x 14.4.1 explicitly says differently as
follows:
"A template-argument for a template-parameter which is a type shall be
a type-id."
C++0x 14.4.1 also immediately gives some examples as follows:
/*-- Source Code Begin --*/
template <class T> class X {};
template <class T> void f(T t) {}
struct {} unnamed_obj;
void f()
{
struct A {};
enum { e1 };
typedef struct { } B;
B b;
X<A> x1; // OK
X<A*> x2; // OK
X<B> x3; // OK
f(e1); // OK
f(unnamed_obj); // OK
f(b); // OK
}
/*-- Source Code End --*/
Obviously, both of the most popular C++ compiler and C++0x relax the
restrictions put by C++98.
In my view, the new rules without restrictions are intuitive, easy to
use for programmers and easy to implement for compilers. What makes me
most puzzled is the hidden reason for the authors of C++98 to put such
counterintuitive restrictions on compilers and on us innocent
programmers? What's the WHY behind the C++98 restrictions?
To my experience during learning C++, C++ always trys not to put any
restrictions on programmers as much as possible except and ONLY except
the following two cases:
Case 1) One language feature/usage is dangerous and/or easy to misuse
so that some specific restrictions are necessary. e.g. restrictions on
const member functions.
case 2) One language feature/usage can not be implementd by the C++
compilers. e.g. restrictions on static_cast(staic_cast a pointer to a
virtual base to another pointer to its derived class which have at
least two immediate base classes. i.e the notorious diamond
inheritence.)
As the supreme authority in C++ world, I always regard C++98 as a
bible-like masterpiece. I don't believe the authors of C++98 had not
deeply thought the above-mentioned issue over and over before they
decided to put such restrictions into the standard. However, I indeed
could not get a convincing explanation only by myself. So I eagerly
hope someone can give me that. Any help will be highly appreciated,
many thanks in advance!
== 2 of 6 ==
Date: Sat, Feb 6 2010 6:07 am
From: Robert Fendt
And thus spake xmllmx <xmllmx@gmail.com>
Sat, 6 Feb 2010 04:13:32 -0800 (PST):
> Obviously, both of the most popular C++ compiler and C++0x relax the
> restrictions put by C++98.
To call VC++ the "most popular C++ compiler" is actually quite a
bold statement. That holds true only if your entire world
consists of Win32 desktop applications. Other compilers like
Comeau, Intel and GCC exist not without reason. Especially GCC,
which supports nearly any platform on the *planet*. If you look
at other domains like embedded systems, POSIX, scientific
computing etc. you will find that your "most popular" compiler
is more or less useless in every single one of them.
> In my view, the new rules without restrictions are intuitive, easy to
> use for programmers and easy to implement for compilers. What makes me
> most puzzled is the hidden reason for the authors of C++98 to put such
> counterintuitive restrictions on compilers and on us innocent
> programmers? What's the WHY behind the C++98 restrictions?
You *do* know who "authors of C++98" actually are? That's right,
it's a group effort, and one of the most important parts of said
group *are* the compiler manufacturers. So technically they put
the restriction in the standard themselves.
That said, invoking templates with local types can create new
nightmares considering the proper handling of type visibility
and namespaces. Frankly, it does not seem you know too much
about compiler technicalities and especially about the headaches
templates can produce implementation-wise, so you should
perhaps be a bit more cautious about statements like "easy to
implement". To my ears, it does *not* sound exactly 'easy', and
maybe it sounded too risky at the time to dictate that all
compliant compilers had to support the feature. So maybe the
standards committee decided to play it safe; now it is clear that
the feature can be implemented in a "clean" way both concerning
implementation and semantics, so they included it in 0x. But to
speculate on events 12+ years ago is moot.
Regards,
Robert
== 3 of 6 ==
Date: Sat, Feb 6 2010 6:36 am
From: xmllmx
On Feb 6, 10:07 pm, Robert Fendt <rob...@fendt.net> wrote:
> And thus spake xmllmx <xml...@gmail.com>
> Sat, 6 Feb 2010 04:13:32 -0800 (PST):
>
> > Obviously, both of the most popular C++ compiler and C++0x relax the
> > restrictions put by C++98.
>
> To call VC++ the "most popular C++ compiler" is actually quite a
> bold statement. That holds true only if your entire world
> consists of Win32 desktop applications. Other compilers like
> Comeau, Intel and GCC exist not without reason. Especially GCC,
> which supports nearly any platform on the *planet*. If you look
> at other domains like embedded systems, POSIX, scientific
> computing etc. you will find that your "most popular" compiler
> is more or less useless in every single one of them.
>
> > In my view, the new rules without restrictions are intuitive, easy to
> > use for programmers and easy to implement for compilers. What makes me
> > most puzzled is the hidden reason for the authors of C++98 to put such
> > counterintuitive restrictions on compilers and on us innocent
> > programmers? What's the WHY behind the C++98 restrictions?
>
> You *do* know who "authors of C++98" actually are? That's right,
> it's a group effort, and one of the most important parts of said
> group *are* the compiler manufacturers. So technically they put
> the restriction in the standard themselves.
>
> That said, invoking templates with local types can create new
> nightmares considering the proper handling of type visibility
> and namespaces. Frankly, it does not seem you know too much
> about compiler technicalities and especially about the headaches
> templates can produce implementation-wise, so you should
> perhaps be a bit more cautious about statements like "easy to
> implement". To my ears, it does *not* sound exactly 'easy', and
> maybe it sounded too risky at the time to dictate that all
> compliant compilers had to support the feature. So maybe the
> standards committee decided to play it safe; now it is clear that
> the feature can be implemented in a "clean" way both concerning
> implementation and semantics, so they included it in 0x. But to
> speculate on events 12+ years ago is moot.
>
> Regards,
> Robert
I'm sorry for my regarding VC++ as "the most popular C++ compiler". I
think I should rephrase it as "one of the mainstream C++ compilers".
Your explanation about this issue is acceptable.
Thank you very much.
== 4 of 6 ==
Date: Sat, Feb 6 2010 8:55 am
From: "Bo Persson"
xmllmx wrote:
> Dear all,
>
> C++98 14.3.1 explicitly says as follows:
>
> "A local type, a type with no linkage, an unnamed type or a type
> compunded from any of these types shall not be used as a template-
> argument for a template type-parameter."
>
> And the Standard also immediately gives an example:
>
> /*-- Source Code Begin --*/
>
> template <class T> class X {};
>
> void f()
> {
> struct S {};
>
> X<S> x3; // error: local type used as template-argument
> }
>
> /*-- Source Code End --*/
>
> Nevertheless, the source code should can be correctly compiled by
> Visual C++. Moreover, C++0x 14.4.1 explicitly says differently as
> follows:
>
> "A template-argument for a template-parameter which is a type shall
> be a type-id."
>
> C++0x 14.4.1 also immediately gives some examples as follows:
>
> /*-- Source Code Begin --*/
>
> template <class T> class X {};
> template <class T> void f(T t) {}
> struct {} unnamed_obj;
>
> void f()
> {
> struct A {};
> enum { e1 };
> typedef struct { } B;
> B b;
> X<A> x1; // OK
> X<A*> x2; // OK
> X<B> x3; // OK
> f(e1); // OK
> f(unnamed_obj); // OK
> f(b); // OK
> }
>
> /*-- Source Code End --*/
>
> Obviously, both of the most popular C++ compiler and C++0x relax the
> restrictions put by C++98.
>
> In my view, the new rules without restrictions are intuitive, easy
> to use for programmers and easy to implement for compilers. What
> makes me most puzzled is the hidden reason for the authors of C++98
> to put such counterintuitive restrictions on compilers and on us
> innocent programmers? What's the WHY behind the C++98 restrictions?
>
The restriction was there beacuse nobody spent enough time to figure
out what it should mean. If you have two struct S in two different
functions, will that get you one or two X<S>'s?
10 years later, the committee has figured this out , and agreed that
template <class T> class X {};
void f()
{
struct S {};
X<S> x3; // error: local type used as template-argument
}
can be compiled as
template <class T> class X {};
namespace
{
struct S {};
}
void f()
{
X<S> x3; // error: local type used as template-argument
}
which has been legal and well defined all along.
Bo Persson
== 5 of 6 ==
Date: Sat, Feb 6 2010 10:04 am
From: Maxim Yegorushkin
On 06/02/10 16:55, Bo Persson wrote:
> xmllmx wrote:
>> Dear all,
>>
>> C++98 14.3.1 explicitly says as follows:
>>
>> "A local type, a type with no linkage, an unnamed type or a type
>> compunded from any of these types shall not be used as a template-
>> argument for a template type-parameter."
>>
>> And the Standard also immediately gives an example:
>>
>> /*-- Source Code Begin --*/
>>
>> template<class T> class X {};
>>
>> void f()
>> {
>> struct S {};
>>
>> X<S> x3; // error: local type used as template-argument
>> }
>>
>> /*-- Source Code End --*/
>>
>> Nevertheless, the source code should can be correctly compiled by
>> Visual C++. Moreover, C++0x 14.4.1 explicitly says differently as
>> follows:
>>
>> "A template-argument for a template-parameter which is a type shall
>> be a type-id."
>>
>> C++0x 14.4.1 also immediately gives some examples as follows:
>>
>> /*-- Source Code Begin --*/
>>
>> template<class T> class X {};
>> template<class T> void f(T t) {}
>> struct {} unnamed_obj;
>>
>> void f()
>> {
>> struct A {};
>> enum { e1 };
>> typedef struct { } B;
>> B b;
>> X<A> x1; // OK
>> X<A*> x2; // OK
>> X<B> x3; // OK
>> f(e1); // OK
>> f(unnamed_obj); // OK
>> f(b); // OK
>> }
>>
>> /*-- Source Code End --*/
>>
>> Obviously, both of the most popular C++ compiler and C++0x relax the
>> restrictions put by C++98.
>>
>> In my view, the new rules without restrictions are intuitive, easy
>> to use for programmers and easy to implement for compilers. What
>> makes me most puzzled is the hidden reason for the authors of C++98
>> to put such counterintuitive restrictions on compilers and on us
>> innocent programmers? What's the WHY behind the C++98 restrictions?
>>
>
> The restriction was there beacuse nobody spent enough time to figure
> out what it should mean. If you have two struct S in two different
> functions, will that get you one or two X<S>'s?
>
> 10 years later, the committee has figured this out , and agreed that
>
> template<class T> class X {};
>
> void f()
> {
> struct S {};
>
> X<S> x3; // error: local type used as template-argument
> }
>
> can be compiled as
>
> template<class T> class X {};
>
> namespace
> {
> struct S {};
> }
>
> void f()
> {
> X<S> x3; // error: local type used as template-argument
> }
>
>
> which has been legal and well defined all along.
What about the case when there is another function defining struct S.
They would be different types S, right? I.e. it is not quite like
putting another S in the same anonymous namespace.
--
Max
== 6 of 6 ==
Date: Sat, Feb 6 2010 11:04 am
From: "Bo Persson"
Maxim Yegorushkin wrote:
> On 06/02/10 16:55, Bo Persson wrote:
>> xmllmx wrote:
>>> Dear all,
>>>
>>> C++98 14.3.1 explicitly says as follows:
>>>
>>> "A local type, a type with no linkage, an unnamed type or a type
>>> compunded from any of these types shall not be used as a template-
>>> argument for a template type-parameter."
>>>
>>> And the Standard also immediately gives an example:
>>>
>>> /*-- Source Code Begin --*/
>>>
>>> template<class T> class X {};
>>>
>>> void f()
>>> {
>>> struct S {};
>>>
>>> X<S> x3; // error: local type used as template-argument
>>> }
>>>
>>> /*-- Source Code End --*/
>>>
>>> Nevertheless, the source code should can be correctly compiled by
>>> Visual C++. Moreover, C++0x 14.4.1 explicitly says differently as
>>> follows:
>>>
>>> "A template-argument for a template-parameter which is a type
>>> shall be a type-id."
>>>
>>> C++0x 14.4.1 also immediately gives some examples as follows:
>>>
>>> /*-- Source Code Begin --*/
>>>
>>> template<class T> class X {};
>>> template<class T> void f(T t) {}
>>> struct {} unnamed_obj;
>>>
>>> void f()
>>> {
>>> struct A {};
>>> enum { e1 };
>>> typedef struct { } B;
>>> B b;
>>> X<A> x1; // OK
>>> X<A*> x2; // OK
>>> X<B> x3; // OK
>>> f(e1); // OK
>>> f(unnamed_obj); // OK
>>> f(b); // OK
>>> }
>>>
>>> /*-- Source Code End --*/
>>>
>>> Obviously, both of the most popular C++ compiler and C++0x relax
>>> the restrictions put by C++98.
>>>
>>> In my view, the new rules without restrictions are intuitive, easy
>>> to use for programmers and easy to implement for compilers. What
>>> makes me most puzzled is the hidden reason for the authors of
>>> C++98 to put such counterintuitive restrictions on compilers and
>>> on us innocent programmers? What's the WHY behind the C++98
>>> restrictions?
>>
>> The restriction was there beacuse nobody spent enough time to
>> figure out what it should mean. If you have two struct S in two
>> different functions, will that get you one or two X<S>'s?
>>
>> 10 years later, the committee has figured this out , and agreed
>> that template<class T> class X {};
>>
>> void f()
>> {
>> struct S {};
>>
>> X<S> x3; // error: local type used as template-argument
>> }
>>
>> can be compiled as
>>
>> template<class T> class X {};
>>
>> namespace
>> {
>> struct S {};
>> }
>>
>> void f()
>> {
>> X<S> x3; // error: local type used as template-argument
>> }
>>
>>
>> which has been legal and well defined all along.
>
> What about the case when there is another function defining struct
> S. They would be different types S, right? I.e. it is not quite like
> putting another S in the same anonymous namespace.
I guess they would have to be the same S, if they are in the same
source file. If they are in different compilation units, they will get
unique names from the anonymous namespaces.
The possible non-uniqueness of the template instantiation was the
original problem.
Bo Persson
==============================================================================
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 5:23 am
From: "Leigh Johnston"
>
> My 2 cents: Generally when I use pimpl, it's
>
> //header
> #include <string>
>
> class Foo
> {
> public:
> Foo();
> ~Foo();
>
> std::string getName() const; //ex func
> //etc.
> private:
> class FooImpl;
> FooImpl * impl;
> };
>
> //cpp
> class Foo::FooImpl
> {
> public:
> //impl
> };
>
> Foo::Foo() : impl(new Foo::FooImpl) {}
> Foo::~Foo() { delete impl; }
> std::string Foo::getName() const { /*return impl->getName();*/ return
> ""; }
>
> //end example
>
> Most uses of pimpl are as simple as this. I would be skeptical of a
> design which had "multiple pimpl pointers". The constructor body of
> Foo is generally that, no more, no less, give or take the names.
> However, I suppose there's nothing to lose by using std::auto_ptr
> either.
>
Not really, there is nothing wrong with a top-level "model" class containing
multiple objects that you don't want to expose in the model header file to
reduce dependencies and compilation times.
>
> I would think that it would be undefined behavior if Foo::~Foo is
> defined in a scope where FooImpl is an incomplete type. Interestingly
> enough, if I move the Foo::~Foo definition to before the FooImpl class
> definition in the same translation unit, a scope where FooImpl is an
> incomplete type, visual studios 2008 still deletes it as a complete
> type, which completely mystifies me. Is this visual studios protecting
> me from myself, and making it "do the right thing" in a case of
> undefined behavior? Or do I completely fail at understanding the
> template instantiation and name lookup rules?
>
Comeau complains if you do this so I wouldn't trust an individual compiler's
behaviour as to what constitutes undefined behaviour or not.
/Leigh
==============================================================================
TOPIC: ❉♡❉nike shox | nike shox r4 | nike shox r5 | nike shox r3 | nike shox
in www.ecyaya.com
http://groups.google.com/group/comp.lang.c++/t/352bfbaa4ee5f838?hl=en
==============================================================================
== 1 of 1 ==
Date: Sat, Feb 6 2010 8:29 am
From: hero
❉♡❉nike shox | nike shox r4 | nike shox r5 | nike shox r3 | nike shox
in www.ecyaya.com
from china cheap wholesale
Nike released a new athletic Nike Shox shoe - the R3, as part of the
shox family this stylish shoe is sure to be very popular among the
athletes and others who love the latest in style and fashion. R3
delivers with extra padding built into the heel for athletic
purposes,
and practical reasons. And now a large variety of stlyes and colours
of R3 are in stock at our website- www.ecyaya.com.
Product descriptio The nike shox rival asics running shoes have the
following features: top plate distributes impact forces from the heel
to the columns; bottom plate produces a secure base for heel-to-toe
transition; transition wedge allows for a smooth ride. Its been
called
a lot of things: springy, resilient, bouncy. But to a runner, the
Nike
Shox R3 means one thing: responsive cushioning. The top plate
distributes impact forces from the heel to the individual columns,
deflecting like a trampoline. The bottom plate supports the columns,
producing a secure base to guide your foot through the heel-to-toe
transition. The columns control impact by collapsing quickly at
first,
and then slowly returning to their original height. The transition
wedge allows for a smooth ride from the Nike Shox cushioning system
in
the heel to the Air-Sole unit found in the forefoot. Nike Shox
technology, a revolution in cushioning and impact protection,
provides
an optimal environment for cushioning, a slower rate of impact
loading
(which helps reduce the risk of impact-related injuries), and a
uniquely responsive feel. The highly resilient foam in Nike Shox
columns is made of energy-efficient material that enhances durability
and spring. It?s great and comfortable using for running and walking,
Please see the pictures for more details. They are the model in the
picture
Here is the Nike Shox R4 kids, you can feel the best in the R4 shoes,
and its responsive cushioning provides you with a great ride. It has
synthetic upper for support and phylon midsole with Air-sole unit. R4
has the original Nike Shox technology in the heel and BRS1000 carbon
rubber outsole for durability- www.ecyaya.com
==============================================================================
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 2 ==
Date: Sat, Feb 6 2010 10:16 am
From: Branimir Maksimovic
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
Greets
== 2 of 2 ==
Date: Sat, Feb 6 2010 10:45 am
From: Maxim Yegorushkin
On 05/02/10 17:55, Kurt wrote:
> Hi all,
>
> I have a client/server project written by a hired contractor, but it's got a fairly big bug when it comes to dealing with thread and sockets. It creates threads but never closes the handle to them, thus causing the server to accumulate hundreds of thousands of open handles in a day or so. The client and server both share similar code, but I'll just post the server-side.
>
> void CTransferServer::startCommandThread() {
> int iCommandPort = _wtoi(configHandler->getTextValue(L"TransferCommandPort"));
> SOCKET socCommand = CSocHandler::getServerSocket(iCommandPort);
> if (socCommand == INVALID_SOCKET) {
> //cout<< "\nCould not create transfer command server socket."<< WSAGetLastError();
> return;
> }
>
> if (listen(socCommand, SOMAXCONN)) {
> //cout<< "\nCould not listen on transfer command port."<< WSAGetLastError();
> return;
> }
> while (blStarted) {
> SOCKET sa = accept(socCommand, 0, 0); // block for connection request
> if (sa ==INVALID_SOCKET) {
> break;
> }
> void **params = (void **) malloc(sizeof(void*)*2);
> SOCKET *s = new SOCKET;
> *s = sa;
> params[0] = (void*)this;
> params[1] = (void*)s;
> DWORD dwGenericThread;
> //unsigned int iGenericThread;
> HANDLE hWorkerThread = CreateThread(NULL, 0, transferCommandWorkerThread, params, 0,&dwGenericThread);
> //HANDLE hWorkerThread = (HANDLE)_beginthreadex(NULL, 0, transferCommandWorkerThread, params, 0,&iGenericThread);
> //WaitForSingleObject(hWorkerThread, INFINITE);
> //CloseHandle(hWorkerThread);
> }
> }
>
> DWORD WINAPI transferCommandWorkerThread(LPVOID param) {
> void **params = (void **)param;
> CTransferServer *transferServer = (CTransferServer*)params[0];
> SOCKET *commandSocket = (SOCKET*)params[1];
> transferServer->handleCommandConnection(*commandSocket);
> delete commandSocket;
> free((void*)params);
> return 0;
> }
>
> So, the while-loop creates a socket that accepts a connection and passes it off to the thread. I am not 100% familiar with sockets and threads, but I have a general idea about them. As far as I can tell, the workerThread does close/delete the sockets properly, but the main loop never closes the handle to the thread. I tried adding WaitForSingleObject() and CloseHandle() but it appears to close the thread prematurely. This causes the communication between the server and client to get disconnected or in a deadlock state. I heard that _beginthreadex() is better to use, but when I tried that, I believe it made matters worse.
>
> Any ideas on how to debug this or perhaps a better way of writing this?
If you can you boost, you should. It can take care of all the
boilerplate code for starting a new thread and passing arguments to that
thread. Applying it to your problem:
#include <boost/bind.hpp>
#include <boost/thread.hpp>
struct CTransferServer
{
void startCommandThread();
void handleCommandConnection(SOCKET client);
bool blStarted;
};
void CTransferServer::startCommandThread() {
// ...
SOCKET socCommand;
while (blStarted) {
SOCKET sa = accept(socCommand, 0, 0);
if (sa ==INVALID_SOCKET)
break;
boost::thread( // start a new thread
boost::bind( // in a member function of this
&CTransferServer::handleCommandConnection, this
, sa // pass this extra argument
)
);
}
}
It is much shorter as the original version and does not leak thread handles.
A gotcha, just in case, CTransferServer destructor will need to make
sure that no threads are running before it returns. Otherwise those
threads will end up accessing an already destroyed object.
--
Max
==============================================================================
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