What is the use of keyword __cdel in function signature.

C

code break

Hi all,

I came across some unexpected funtion definition as follows

int __cdel function_name(int arg1,int arg2)
{
statements ;
.
.
}

can any one tell me about the use of keyword __cdel in above function
defintion..

it help lot for me .
 
K

Keith Thompson

code break said:
I came across some unexpected funtion definition as follows

int __cdel function_name(int arg1,int arg2)
{
statements ;
.
.
}

can any one tell me about the use of keyword __cdel in above function
defintion..

There is no __cdecl keyword in standard C. It's an extension
implemented by your compiler. (It probably specifies something about
the calling convention, something that the compiler should normally be
able to decide for itself.)

For more information, consult the documentation for your compiler.
Failing that, a Google search for "__cdecl" gets 157,000 hits.
Failing that, try a newsgroup appropriate to your compiler and/or
operating system.
 
J

Jaspreet

code said:
Hi all,

I came across some unexpected funtion definition as follows

int __cdel function_name(int arg1,int arg2)
{
statements ;
.
.
}

can any one tell me about the use of keyword __cdel in above function
defintion..

it help lot for me .

__cdecl is a C/C++ function / method calling convention. It is also a
default calling behavior for C functions. It allows for variable
arguments unlike __stdcall calling convention. The arguments are passed
right to left. It is the responsiblity of calling function to do stack
cleanup.

You would probably not need to use __cdecl since its the default unless
you have specified __stdcall in compiler options.

For a much better explanantion take help from google.
 
J

Jaspreet

Jaspreet said:
__cdecl is a C/C++ function / method calling convention. It is also a
default calling behavior for C functions. It allows for variable
arguments unlike __stdcall calling convention. The arguments are passed
right to left. It is the responsiblity of calling function to do stack
cleanup.

You would probably not need to use __cdecl since its the default unless
you have specified __stdcall in compiler options.

For a much better explanantion take help from google.

Forgot to add that the above explanation is from Microsoft VC++ point
of view.
 
B

Bas Wassink

Jaspreet said:
Forgot to add that the above explanation is from Microsoft VC++ point
of view.

Nobody seems to notice that the OP is asking about '__cdel', not '__cdecl'.

Bas
 
J

Jaspreet

Bas said:
Nobody seems to notice that the OP is asking about '__cdel', not '__cdecl'.

Bas

Silly me. Thanks for pointing that out. Not only me even Keith also got
it wrong. After all to err is to human. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top