int __cdecl main(int argc, char **argv)

This is the main function declaration for a Winsock Client Source Code. Can someone explain what the __cdecl is? And why are there two *'s in front of argv instead of one?
The __cdecl portion is the calling convention. I'd guess this may be necessary for a Windows project since the default calling convention there is stdcall, while main() expects to be using cdecl.
https://en.wikipedia.org/wiki/X86_calling_conventions#cdecl

The two asterisks just indicate that argv is of type "pointer to pointer to char"; in this case, it is a pointer to an array of C-style strings. Which, if you'll remember, are in fact arrays of char themselves.
Last edited on
The default calling convention is cdecl.

https://msdn.microsoft.com/en-us/library/zkwh89ks.aspx
I see. Crossed out the incorrect information.
Topic archived. No new replies allowed.