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 » Why ReadWithBarrier returns bool (current svn)
Re: Why ReadWithBarrier returns bool (current svn) [message #15736 is a reply to message #15734] Tue, 06 May 2008 21:25 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
hans wrote on Tue, 06 May 2008 14:31

Hi, we have
template <class U>
inline bool ReadWithBarrier(const volatile U& b)
{
	volatile bool tmp = b;
	ReadMemoryBarrier();
	return tmp;
}


but use it as it would return an int too, like in

inline int  AtomicRead(const volatile Atomic& t)      { return ReadWithBarrier(t); }


So I would suggest to replace in ReadWithBarrier the bool with the U template parameter (in tmp var and return type).

Cheers, Hans.


Yes, already done. You caught us in the process Smile

BTW, final version removes second volatile too -> leads to more optimal but still correct code on both GCC and MSC (7.1, 8, 9).

Mirek
 
Read Message
Read Message
Read Message
Previous Topic: How to re-initialize random generator?
Next Topic: U++ core app as DLL: memory manager problems?
Goto Forum:
  


Current Time: Mon May 20 05:09:15 CEST 2024

Total time taken to generate the page: 0.00791 seconds