Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » #ifdef PLATFORM_POSIX #include <bits/atomicity.h> for POSIX ?
#ifdef PLATFORM_POSIX #include <bits/atomicity.h> for POSIX ? [message #10585] Tue, 17 July 2007 19:37 Go to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi,

is the include (lines 340 to 342) in Core.h really needed?

#ifdef PLATFORM_POSIX
#include <bits/atomicity.h>
#endif

The include on my system is not needed, at least the compiler does not complain.

Background for this question is a compile error when using GCC 4.2 where atomicity.h is located in ext dir and I wonder if I can simply uncomment it.
I need this information for FreeBSD 7 systems, since GCC 4.2 is the default compiler there.

Matthias


931b81e7ea53320dccc37375b34b38c3
Re: #ifdef PLATFORM_POSIX [message #10595 is a reply to message #10585] Tue, 17 July 2007 23:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
It is important in MT. It introduces atomic incerements / decrements.

Try to compile something MT to find out Wink

Mirek
Re: #ifdef PLATFORM_POSIX [message #10602 is a reply to message #10595] Wed, 18 July 2007 10:29 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Thanks, I guessed that, but I have also tried with a MT app and it works.
I double-check again today.
Can somebody try it on another POSIX platform?

Matthias
Re: #ifdef PLATFORM_POSIX [message #10603 is a reply to message #10602] Wed, 18 July 2007 13:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
It is not unlikely that it is indirectly included by some other header (GCC version of std::string e.g.).
Re: #ifdef PLATFORM_POSIX [message #10611 is a reply to message #10603] Wed, 18 July 2007 23:07 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Ok, what about replacing mentioned section with
#ifdef PLATFORM_POSIX
#ifdef COMPILER_GCC
#if __GNUC__ > 3
#include <ext/atomicity.h>
#else
#include <bits/atomicity.h>
#endif
#else
#include <bits/atomicity.h>
#endif
#endif


maybe it is needed to also include minor version number with __GNUC_MINOR__ in the check (I only checked with gcc 4.2).

Matthias
Re: #ifdef PLATFORM_POSIX [message #10639 is a reply to message #10611] Fri, 20 July 2007 10:22 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Why not, but I am sure I have built the current code with GCC4.1....
Re: #ifdef PLATFORM_POSIX [message #10643 is a reply to message #10639] Fri, 20 July 2007 10:56 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
then I can confirm that I'm using gcc 4.2.0 (ArchLinux) and it requires <ext/atomicity.h>
But I can't remember if that changed with 4.2 or 4.1.xx
Re: #ifdef PLATFORM_POSIX [message #10644 is a reply to message #10639] Fri, 20 July 2007 11:21 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
luzr wrote on Fri, 20 July 2007 10:22

Why not, but I am sure I have built the current code with GCC4.1....


Then I suggest to also use __GNUC_MINOR__:

#ifdef PLATFORM_POSIX
#ifdef COMPILER_GCC
#if ((__GNUC__ > 3) && (__GNUC_MINOR__ > 1))
#include <ext/atomicity.h>
#else
#include <bits/atomicity.h>
#endif
#else
#include <bits/atomicity.h>
#endif
#endif
Re: #ifdef PLATFORM_POSIX [message #10848 is a reply to message #10644] Wed, 01 August 2007 16:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
OK, why not...
Re: #ifdef PLATFORM_POSIX [message #10856 is a reply to message #10848] Wed, 01 August 2007 18:03 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, I have checked removal variant and it works for me. Most likely, the required stuff is included with STL.

So I have just removed the #include for now.

(Sorry for takeing so long...).

Mirek
Previous Topic: best way to parse XML/svg/html style kind attribute pairs?
Next Topic: Array & Gdiplus::Pen problem
Goto Forum:
  


Current Time: Wed May 01 16:50:06 CEST 2024

Total time taken to generate the page: 0.02796 seconds