On 21/08/2013 3:39 AM, Gerard Ziemski wrote:
On 8/20/2013 4:14 AM, Dmitry Samersoff wrote:
2. Why are we using the the "::" C++ name space before mach/pthread C
>APIs calls? I understand that you might be just following the existing
>pattern in the file, I'm just wondering if you, or anyone knows why.
C++ :: means global scope and it solves naming conflict if you would
have pthread_mach_thread_np() in your namespace and don't specify
namespace explicitly.
It's very good practice to always use :: for all os functions we call.
Is it (or should it be) part of Oracle's recommended coding guidelines?
It is a two edged sword. There have been bugs where the we call the
global function instead of a local one, and local instead of a global.
Used to be quite complex/confusing with the hpi interface - too many
open/close/read/write methods.
Personally I find it totally unnecessary and distracting on things like
pthreads library calls. We should never define our own methods with the
same names as those.
Cheers,
David
cheers