[interprocess] Superfluous "volatile" in atomic_add_unless32

29 Jul
2010
29 Jul
'10
7:44 p.m.
In this: inline bool atomic_add_unless32(volatile boost::uint32_t *mem, boost::uint32_t value, volatile boost::uint32_t unless_this) I think "volatile" on the last argument has no purpose and probably reduces speed slightly. Will it not merely cause the compiler to fetch the formal argument from memory every time it's needed? And isn't that of no use since nothing is modifying the formal argument during the function execution? So: 1) Caller puts actual argument on stack. 2) Caller calls atomic_add_unless32. 3) atomic_add_unless32 treats stack variable as volatile, wasting time (not much) because variable isn't actually changing.
5442
Age (days ago)
5442
Last active (days ago)
0 comments
1 participants
participants (1)
-
Capehart, Nolan