Yes, I know that \"cdecl\" is the name of a prominent calling convention, so please don\'t explain calling conventions to me. What I\'m asking is what the abbreviation (?) \"cd
You're reading too much into this. It stands for the calling convention of the implementation for calling C functions in general (but especially important with varargs).
It doesn't have to be an abbreviation for something that combines "C" and "declaration"; names are just names, especially in programming. Mnemonics help, but even though "malloc" means "allocate memory", it has additional meaning that we know and attach to it; "alloca" also "allocates memory", for example.
Or take "struct" which "means" a "structure", but "structure" is so generic by itself that without the meaning we attach subconsciously to "struct" we would be hopelessly lost – as new programmers still learning the terminology are often lost.
Updated I've totally revised this, after the comments pointing out how wrong I was. cdecl
means that this function uses the same calling convention that C
functions use. extern "C"
means, in addition, that the function name should not undergo C++
name-mangling.
As for why it's called cdecl
, I don't know any more.
It comes from C function that was declared (in contrast to a C function that was not declared which was common in K&R C).
At the time it was coexisting with pascal calling convention (wher the callee cleared the stack), so it kind of made sense to call it after the programming language.
Everything you might ever want to know about calling conventions.
C declaration. A declaration introduced by/for C.
[edit]
I honestly have to admit I don't actually know if that is what is stands for, although it is actually introduced by/for C. But since the caller
has to clean up allocated memory (as opposed to most other calling conventions). It could also be a mnemonic for 'Caller Does End CLeaning' which I think is actually a good memory aid. :D