Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cdecl

Status
Not open for further replies.

MarcoMB

Programmer
Oct 24, 2006
61
IT
Can someone explains what's the function of "cdecl" for example in stdio.h ?
for example the following line

_CRTIMP int __cdecl printf(const char *, ...);

what does?
In stdio.h there isn't classical functions definitions, so where are definitions? the line above calls something related with definitions such as modules or dlls?
 
MSDN said:
__cdecl
Microsoft Specific —>
This is the default calling convention for C and C++ programs. ...
Place the __cdecl modifier before a variable or a function name. Because the C naming and calling conventions are the default, the only time you need to use __cdecl is when you have specified the /Gz (stdcall) or /Gr (fastcall) compiler option. The /Gd compiler option forces the __cdecl calling convention.
...
Use modern (Standard) <cstdio> header in C++ code. Of course, no function definitions in cstdio (and in stdio.h) header. There are function declarations only in std header files. Function bodies (definitions) are placed in run-time library (RTL) source modules. For example, see printf source in printf.c file of RTL (get Pro or Enterprise VS editions with RTL sources included).
In VS distributives all RTL modules are compiled and packed into system lib/dll files.
So don't worry about RTL functions definitions...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top