I have this code:
1. bool MyClass::open() {
2. int fd = ::open("file.txt",flags);
3. }
Does the "::" from the line 2 before calling open means something?
I have this code:
1. bool MyClass::open() {
2. int fd = ::open("file.txt",flags);
3. }
Does the "::" from the line 2 before calling open means something?
It means "open
from the global namespace". It is a way to disambiguate with MyClass::open
, which is a name that would be picked up if you said open
without the leading ::
.
It's scope resolution operator and it says, that the function (open
in this case) is in the global namespace.