I found a C++ file in PARSEC benchmark suite and saw some functions like this:
long Rng::rand()
{
return _rng->randInt();
}
what does the ::
in the name of the function do here?
I found a C++ file in PARSEC benchmark suite and saw some functions like this:
long Rng::rand()
{
return _rng->randInt();
}
what does the ::
in the name of the function do here?
In C++ ::
is the Scope resolution operator.
In this case it tells the compiler that it is a defintiion for rand()
method which is a member function for Rng
class/structure/union/namespace.
In C, ::
is a syntax error unless it occurs inside a comment, a character literal or a string literal.
The ::
can only appear in C++ code.