Overview
Features
Download
Documentation
Community
Add-Ons & Services

AtomicCounter.h gives compilation warnings

A general discussion forum.

AtomicCounter.h gives compilation warnings

Postby marlowabnp » 22 Mar 2011, 11:13

When I turn on various GCC strictness options I get compilation warnings from the header AtomicCounter.h. It is abou the increment and decrement operators. The compiler is expecting a reference to the object to be returned. Instead a ValueType is returned. Can someone explain this please? Why is Poco returning the underlying type instead of the object type?

Regards,

Andrew Marlow
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: AtomicCounter.h gives compilation warnings

Postby marlowabnp » 15 May 2011, 18:21

I would really like to know why Poco is returning the underlying type instead of the object type. It is preventing a clean compilation with the flags I am using but there may be some good reason for it that I am not aware of. I would appreciate being enlightened please.
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: AtomicCounter.h gives compilation warnings

Postby marlowabnp » 08 Jul 2011, 09:53

I really am quite suprised that there has been no response on this yet. I am wondering -- am I the only one that tries to use the strict compilation warnings on a project that uses Poco? Has Poco ever been built with these strict options. It would seem not.

I know they are only warnings but IMHO it is good to get clean compiles with the highest level of warning turned on.

Regards,

Andrew Marlow
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: AtomicCounter.h gives compilation warnings

Postby marlowabnp » 27 Aug 2011, 13:42

I have just discovered that I now get similar warnings when compiling stuff that uses the latest boost atomic counters. So Poco is not alone.

But surely we can do better. IMO it is better for Poco (or any other project for that matter) to compile cleanly at the highest warning level, than not. Shall I file bug reports for these compilation warnings?
marlowabnp
 
Posts: 89
Joined: 08 Nov 2010, 17:29

Re: AtomicCounter.h gives compilation warnings

Postby guenter » 29 Aug 2011, 22:11

I have given up on trying to achieve clean compilation at the highest warning levels. Getting clean compilation with default warning levels already is a challenge in a cross-platform environment with multiple different compilers, but compilation at -Wall level is IMO simply not worth it (unless maybe for people with too much time and nothing else to do...).

Now, for the reason why AtomicCounter is implemented the way it is: it's there simply to make the class easier to use as a replacement for an int-type counter. Example:

Code: Select all
if (--counter == 0)
{
}


is much easier to read than:

Code: Select all
if ((--counter).value() == 0)
{
}
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest