Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. what the heck is __stdcall about?

what the heck is __stdcall about?

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3037427
    wrote on last edited by
    #1

    what the heck is __stdcall about?

    N H 2 Replies Last reply
    0
    • U User 3037427

      what the heck is __stdcall about?

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      sruti_p wrote:

      what the heck is __stdcall about?

      Hehe nice way to ask?:rolleyes: Calling conventions demystified[^] by Nemanja.


      Nibu thomas A Developer Programming tips[^]  My site[^]

      S 1 Reply Last reply
      0
      • U User 3037427

        what the heck is __stdcall about?

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See Calling Convetions in Microsoft Visual C++[^]_**


        **_

        whitesky


        1 Reply Last reply
        0
        • N Nibu babu thomas

          sruti_p wrote:

          what the heck is __stdcall about?

          Hehe nice way to ask?:rolleyes: Calling conventions demystified[^] by Nemanja.


          Nibu thomas A Developer Programming tips[^]  My site[^]

          S Offline
          S Offline
          Smith
          wrote on last edited by
          #4

          __cdecl is the default calling convention for C and C++ programs. The advantage of this calling convetion is that it allows functions with a variable number of arguments to be used. The disadvantage is that it creates larger executables. __stdcall is used to call Win32 API functions. It does not allow functions to have a variable number of arguments. __fastcall attempts to put arguments in registers, rather than on the stack, thus making function calls faster. Thiscall calling convention is the default calling convention used by C++ member functions that do not use variable arguments. What's "variable number of arguments" ?? means Overloaded functions? And about _fastcall, if it's going to be faster, why not use it for every function we create? can you tell me about , where a particular convention must be used strictly. (yes, I've not gone through the article fully, but if you can explain please do) :)

          S N U 3 Replies Last reply
          0
          • S Smith

            __cdecl is the default calling convention for C and C++ programs. The advantage of this calling convetion is that it allows functions with a variable number of arguments to be used. The disadvantage is that it creates larger executables. __stdcall is used to call Win32 API functions. It does not allow functions to have a variable number of arguments. __fastcall attempts to put arguments in registers, rather than on the stack, thus making function calls faster. Thiscall calling convention is the default calling convention used by C++ member functions that do not use variable arguments. What's "variable number of arguments" ?? means Overloaded functions? And about _fastcall, if it's going to be faster, why not use it for every function we create? can you tell me about , where a particular convention must be used strictly. (yes, I've not gone through the article fully, but if you can explain please do) :)

            S Offline
            S Offline
            Steve S
            wrote on last edited by
            #5

            Variable number of arguments: Think printf, where you can pass one or more arguments, and the format control string determines how many arguments there are (hopefully correctly!). fastcall wouldn't be suitable for functions that take more than two or three arguments, and in some cases might be slower; there aren't an unlimited number of registers on a 32 bit processor. Generally, you don't need to specify the calling convention, but in some cases, you do, simply to ensure that the function has the one expected. Good examples are the functions you pass to things like qsort() and _beginthreadex(). Steve S Developer for hire

            S 1 Reply Last reply
            0
            • S Steve S

              Variable number of arguments: Think printf, where you can pass one or more arguments, and the format control string determines how many arguments there are (hopefully correctly!). fastcall wouldn't be suitable for functions that take more than two or three arguments, and in some cases might be slower; there aren't an unlimited number of registers on a 32 bit processor. Generally, you don't need to specify the calling convention, but in some cases, you do, simply to ensure that the function has the one expected. Good examples are the functions you pass to things like qsort() and _beginthreadex(). Steve S Developer for hire

              S Offline
              S Offline
              Smith
              wrote on last edited by
              #6

              thanks :) NULL

              1 Reply Last reply
              0
              • S Smith

                __cdecl is the default calling convention for C and C++ programs. The advantage of this calling convetion is that it allows functions with a variable number of arguments to be used. The disadvantage is that it creates larger executables. __stdcall is used to call Win32 API functions. It does not allow functions to have a variable number of arguments. __fastcall attempts to put arguments in registers, rather than on the stack, thus making function calls faster. Thiscall calling convention is the default calling convention used by C++ member functions that do not use variable arguments. What's "variable number of arguments" ?? means Overloaded functions? And about _fastcall, if it's going to be faster, why not use it for every function we create? can you tell me about , where a particular convention must be used strictly. (yes, I've not gone through the article fully, but if you can explain please do) :)

                N Offline
                N Offline
                Nibu babu thomas
                wrote on last edited by
                #7

                Meat Loaf wrote:

                What's "variable number of arguments" ?? means Overloaded functions?

                You must have used printf, sprintf, fprintf, scanf, sscanf etc. They all take variable number of arguments. Take a look at va_start, va_end, va_arg. __cdecl calling convention specifies that the caller has to clean up the stack leading to larger executable size. Hence permitting the use of variable number of arguments.

                Meat Loaf wrote:

                __stdcall is used to call Win32 API functions. It does not allow functions to have a variable number of arguments.

                Yeah true. For eg: WINAPI, PASCAL are #defined to be __stdcall. This is windows specific. This means the callee has to clean up the stack just before the callee returns hense variable number of arguments cannot be used here.

                Meat Loaf wrote:

                __fastcall attempts to put arguments in registers, rather than on the stack, thus making function calls faster.

                Meat Loaf wrote:

                And about _fastcall, if it's going to be faster, why not use it for every function we create?

                Because we have limited number of registers.

                Meat Loaf wrote:

                can you tell me about , where a particular convention must be used strictly.

                You have to decide. Where what should be used. __stdcall doesn't permit variable number of arguments hence which calling convention will you use?

                Meat Loaf wrote:

                Thiscall calling convention is the default calling convention used by C++ member functions that do not use variable arguments.

                This calling convention allows class member functions to have the implicit this argument.

                Meat Loaf wrote:

                (yes, I've not gone through the article fully

                Then please do. :)


                Nibu thomas A Developer Programming tips[^]

                1 Reply Last reply
                0
                • S Smith

                  __cdecl is the default calling convention for C and C++ programs. The advantage of this calling convetion is that it allows functions with a variable number of arguments to be used. The disadvantage is that it creates larger executables. __stdcall is used to call Win32 API functions. It does not allow functions to have a variable number of arguments. __fastcall attempts to put arguments in registers, rather than on the stack, thus making function calls faster. Thiscall calling convention is the default calling convention used by C++ member functions that do not use variable arguments. What's "variable number of arguments" ?? means Overloaded functions? And about _fastcall, if it's going to be faster, why not use it for every function we create? can you tell me about , where a particular convention must be used strictly. (yes, I've not gone through the article fully, but if you can explain please do) :)

                  U Offline
                  U Offline
                  User 3037427
                  wrote on last edited by
                  #8

                  Thanks for ur reply.:)

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups