Home » U++ Library support » U++ MT-multithreading and servers » Intentionally inconstistent use of "Atomic" in Mt.h?
Re: Intentionally inconstistent use of "Atomic" in Mt.h? [message #14167 is a reply to message #14166] |
Sat, 16 February 2008 17:36 |
Werner
Messages: 234 Registered: May 2006 Location: Cologne / Germany
|
Experienced Member |
|
|
luzr wrote on Sat, 16 February 2008 17:03 | Well, but you should not directly assign Atomic to int, you should rather use AtomicRead...
|
A misunderstanding? If so, sorry for expressing the issue insufficiently!
I'm talking about the all the "Atomic..." functions in Mt.h, i. e.
AtomicDec,
AtomicInc,
AtomicRead,
AtomicWrite,
AtomicXAdd.
They all have an "Atomic&" as parameter but treat it with an "int" and/or return an "int".
If - and this is the case when using the MSC - "Atomic" is a "long" in disguise, namely typedef'd, implicit casts are inevitable.
I would prefer explicit casts or at least casts which are obvious to me. That is why I suggest to replace the "int" arguments and/or return types with "Atomics".
Werner
P. S.:
"AtomicDec", "AtomicInc", and "AtomicXAdd" are "global" functions. If you discourage their usage, you should document that.
W.
|
|
|
Goto Forum:
Current Time: Thu May 23 18:43:06 CEST 2024
Total time taken to generate the page: 0.02223 seconds
|