what's the use of "__cdecl"?

V

Virtual_X

i am beginner to c++ when i open the file "stdio.h" i have found the
line

_CRTIMP int __cdecl remove (const char*);

and similar lines to it

so what's "_CRTIMP"
and
"__cdecl"
and the use of them
notice: i use mingw
 
A

Alf P. Steinbach

* Virtual_X:
i am beginner to c++ when i open the file "stdio.h" i have found the
line

_CRTIMP int __cdecl remove (const char*);

and similar lines to it

so what's "_CRTIMP"
and
"__cdecl"
and the use of them
notice: i use mingw

Neither _CRTIMP nor __cdecl are defined by the standard.

_CRTIMP is simply a macro, which probably expands to some non-standard
calling convention specification or to nothing, depending. "CRT"
probably means "C Runtime Library". "IMP" probably means "import".

__cdecl is a calling convention specifier supported by Visual C++ and
some other Windows C++ compilers.

Read your documentation if you're really interested.

But in general, the contents of and language extensions and non-portable
hacks used in the vendor's headers should be of little concern to a
beginner.
 
V

Victor Bazarov

Virtual_X said:
i am beginner to c++ when i open the file "stdio.h" i have found the
line

_CRTIMP int __cdecl remove (const char*);

and similar lines to it

so what's "_CRTIMP"
and
"__cdecl"
and the use of them
notice: i use mingw

That's something compiler-specific. You need to ask in 'gnu.g++.help'
newsgroup.

V
 
B

Barry Ding

i am beginner to c++ when i open the file "stdio.h" i have found the
line

_CRTIMP int __cdecl remove (const char*);

and similar lines to it

so what's "_CRTIMP"
and
"__cdecl"
and the use of them
notice: i use mingw

_CRTIMP is proprably a macro in MSVC crt library, which is short for
CRT Implemetation I guess, you can check it out in the <crtdefs.h>
it works as __declspec(dllimport) when you're a client programmer
(most of us), and nothing when the library developer is building the
library. It's switched by the preproccessor _DLL.

__cdecl is the default c/c++ function calling convention specifier,
you don't have to it because it's default (the compiler will add it
for you if no specifier for the function); as a library function, they
expicitly write it out maybe because of portability
other calling conventions include: fastcall, thiscall, pascal ...
 

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

Forum statistics

Threads
474,291
Messages
2,571,453
Members
48,137
Latest member
IndiraMcCo

Latest Threads

Top