Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C functions with : : (double colon) syntax?

Tags:

c

I have come across this " :: " double colon syntax in many functions in a C file and I'm not at all sure what this is?!

My Googling results seems to say this is the GDB Scope Resolution Operator, although I haven't found many examples of this nor seen it mentioned before in C tutorials (it seems to appear a lot more in C++ source code..).

Also I've never yet used GDB.

Here is one example function from the C sourcecode I've found it in:

     Player :: Move (Pos *f, Pos *t)
{
    board->Move (f, t);
    board->Dump ();
    PaintBoard ();
    return 1;
}

So I'm grateful for some good help and explanation of this "::" operator in C.

My C knowledge is very basic and just now I do not yet understand what the "- >" operators mean but I hope to figure out these all these operators and pointer actions in these functions as I learn more C!

like image 565
rpd Avatar asked Jul 27 '26 06:07

rpd


1 Answers

:: is not C but is the C++ scope resolution operator (C++11, 3.3.6p2).

See http://en.wikipedia.org/wiki/Scope_resolution_operator for more information.

like image 187
ouah Avatar answered Jul 30 '26 02:07

ouah