سوال دوم :
من تفاوت و طرز استفاده __stdcall ، __cdecl، __fastcall، __thiscallرا بلد نیستم، در MSDN نگاه کردم ظاهرا کامل توضیح داده بود من کلمه کلمه ترجمه کردم ولی آخرش نفهمیدم چی شد، یعنی متوجه نشدم دقیقا وقتی از این ها استفاده می کنی چه اتفاقی می افته ؟ یا یکسری جاها گفته بود اگر در چنین وضعیتی باشید ف استفاده از این بهتره زیرا . . ..
من نه شرطش را متوجه شدم و نه دلیلش را.
من توضیحات انگلیسی MSDN را در اینجا ( با لینک کاملش ) قرار می دم ، هرکس که فهمید چی گفته لطفا توضیح بده ( بی زحمت توضیح کامل ) اگر لطف کنید ترجمه دقیق فارسی آن را بگذارید ، من کم کم یاد می گیرم متن انگلیسی بخوانم.
با تشکر از لطف دوستان-ببخشید اینقدر سوال می پرسما
__thiscall :
The
__thiscall calling convention is used on member functions and is the default calling convention used by C++ member functions that do not use variable arguments. Under
__thiscall, the callee cleans the stack, which is impossible for
vararg functions. Arguments are pushed on the stack from right to left, with the
this pointer being passed via register ECX, and not on the stack, on the x86 architecture.
One reason to use
__thiscall is in classes whose member functions use
__clrcall by default. In that case, you can use
__thiscall to make individual member functions callable from native code.
When compiling with
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
, all functions and function pointers are
__clrcall unless specified otherwise.
In releases before Visual C++ 2005, the thiscall calling convention could not be explicitly specified in a program, because
thiscall was not a keyword.
vararg member functions use the
__cdecl calling convention. All function arguments are pushed on the stack, with the
this pointer placed on the stack last
Because this calling convention applies only to C++, there is no C name decoration scheme.
On Itanium Processor Family (IPF) and x64 machines,
__thiscall is accepted and ignored by the compiler; on an IPF chip, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__fastcall :
The
__fastcall calling convention specifies that arguments to functions are to be passed in registers, when possible. The following list shows the implementation of this calling convention.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__cdecl :
This is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do
vararg functions. The
__cdecl calling convention creates larger executables than
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
, because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.
On Itanium Processor Family (IPF) and x64 processors,
__cdecl is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
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
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
compiler option forces the
__cdecl calling convention.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition. Given this class definition,
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__stdcall:
The
__stdcall calling convention is used to call Win32 API functions. The callee cleans the stack, so the compiler makes
vararg functions
__cdecl. Functions that use this calling convention require a function prototype.
The
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
compiler option specifies
__stdcall for all functions not explicitly declared with a different calling convention.
Functions declared using the
__stdcall modifier return values the same way as functions declared using
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
.
On Itanium Processor Family (IPF) and x64 processors,
__stdcall is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
---------- Post added at 06:00 AM ---------- Previous post was at 05:58 AM ----------
می دونی ترجه کلمه کلمه با بابیلون انجام می دم ، مشکلم 2 تاست :
1. بعضی از کلمات معنای لغوی نمی دهند ، و اصطلاح هستند
2.جمله بندی به طوری که معنی بده
برای همینه که از شما خواستم معنای دقیق را هم بنویسید تا بتوانم هی با متن انگلیسیش مقایسه کنم تا دستم بیاد.
ممنون
---------- Post added at 06:02 AM ---------- Previous post was at 06:00 AM ----------
می دونی ترجه کلمه کلمه با بابیلون انجام می دم ، مشکلم 2 تاست :
1. بعضی از کلمات معنای لغوی نمی دهند ، و اصطلاح هستند
2.جمله بندی به طوری که معنی بده
برای همینه که از شما خواستم معنای دقیق را هم بنویسید تا بتوانم هی با متن انگلیسیش مقایسه کنم تا دستم بیاد.
ممنون
---------- Post added at 06:04 AM ---------- Previous post was at 06:02 AM ----------
سوال دوم :
من تفاوت و طرز استفاده __stdcall ، __cdecl، __fastcall، __thiscallرا بلد نیستم، در MSDN نگاه کردم ظاهرا کامل توضیح داده بود من کلمه کلمه ترجمه کردم ولی آخرش نفهمیدم چی شد، یعنی متوجه نشدم دقیقا وقتی از این ها استفاده می کنی چه اتفاقی می افته ؟ یا یکسری جاها گفته بود اگر در چنین وضعیتی باشید ف استفاده از این بهتره زیرا . . ..
من نه شرطش را متوجه شدم و نه دلیلش را.
من توضیحات انگلیسی MSDN را در اینجا ( با لینک کاملش ) قرار می دم ، هرکس که فهمید چی گفته لطفا توضیح بده ( بی زحمت توضیح کامل ) اگر لطف کنید ترجمه دقیق فارسی آن را بگذارید ، من کم کم یاد می گیرم متن انگلیسی بخوانم.
با تشکر از لطف دوستان-ببخشید اینقدر سوال می پرسما
__thiscall :
The
__thiscall calling convention is used on member functions and is the default calling convention used by C++ member functions that do not use variable arguments. Under
__thiscall, the callee cleans the stack, which is impossible for
vararg functions. Arguments are pushed on the stack from right to left, with the
this pointer being passed via register ECX, and not on the stack, on the x86 architecture.
One reason to use
__thiscall is in classes whose member functions use
__clrcall by default. In that case, you can use
__thiscall to make individual member functions callable from native code.
When compiling with
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
, all functions and function pointers are
__clrcall unless specified otherwise.
In releases before Visual C++ 2005, the thiscall calling convention could not be explicitly specified in a program, because
thiscall was not a keyword.
vararg member functions use the
__cdecl calling convention. All function arguments are pushed on the stack, with the
this pointer placed on the stack last
Because this calling convention applies only to C++, there is no C name decoration scheme.
On Itanium Processor Family (IPF) and x64 machines,
__thiscall is accepted and ignored by the compiler; on an IPF chip, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__fastcall :
The
__fastcall calling convention specifies that arguments to functions are to be passed in registers, when possible. The following list shows the implementation of this calling convention.
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__cdecl :
This is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do
vararg functions. The
__cdecl calling convention creates larger executables than
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
, because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.
On Itanium Processor Family (IPF) and x64 processors,
__cdecl is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
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
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
compiler option forces the
__cdecl calling convention.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition. Given this class definition,
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
__stdcall:
The
__stdcall calling convention is used to call Win32 API functions. The callee cleans the stack, so the compiler makes
vararg functions
__cdecl. Functions that use this calling convention require a function prototype.
The
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
compiler option specifies
__stdcall for all functions not explicitly declared with a different calling convention.
Functions declared using the
__stdcall modifier return values the same way as functions declared using
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]
.
On Itanium Processor Family (IPF) and x64 processors,
__stdcall is accepted and ignored by the compiler; on IPF, by convention, parameters are passed in register.
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition
[ برای مشاهده لینک ، با نام کاربری خود وارد شوید یا ثبت نام کنید ]