Topic: Function prototype and declaration question
Author: Jerry Coffin <jcoffin@taeus.com>
Date: 2000/05/25 Raw View
In article <392A9C47.CBAF0161@ipix.com>, tom.knapp@ipix.com says...
[ ... ]
> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
>
> I understand that the return value is of type "LRESULT". What I am a
> bit puzzled about is the term "CALLBACK". This line is compiled
> properly by MS Visual C++. Is the inclusion of the "CALLBACK" term
> peculiar to the Visual C++ compiler, or is this standard C and/or C++?
> Microsoft documentation indicates that this term specifying the way the
> parameters are put on the stack.
>
> My basic question is this - is this standard C and/or C++ or is it
> specific to Microsoft?
It's sort-of Microsoft-specific. Syntactically, it's more or less a
storage class specifier -- e.g. if it was preceded by:
#define CALLBACK extern
#define LRESULT long
then the code would be equivalent to:
long extern WndProc(/* ... */);
which is perfectly legal. In this case, it happens that MS defines
some non-standard storage class specifiers of their own. Depending
on your viewpoint, this might not really be a storage class specifier
at all though: I don't believe you're allowed to include more than
one storage class specifier for a single function, but I believe you
CAN legally have something like:
LRESULT CALLBACK extern WndProc(/* ... */);
so at the very least they're using a non-standard keyword, and what
they're doing probably doesn't even quite fit as legal C syntax
either.
--
Later,
Jerry.
The universe is a figment of its own imagination.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Thomas R. Knapp" <tom.knapp@ipix.com>
Date: 2000/05/24 Raw View
I have a question regarding function declaration as used in MS Windows
programming. An example is:
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
I understand that the return value is of type "LRESULT". What I am a
bit puzzled about is the term "CALLBACK". This line is compiled
properly by MS Visual C++. Is the inclusion of the "CALLBACK" term
peculiar to the Visual C++ compiler, or is this standard C and/or C++?
Microsoft documentation indicates that this term specifying the way the
parameters are put on the stack.
My basic question is this - is this standard C and/or C++ or is it
specific to Microsoft?
Thanks.
--
Best regards,
Thomas R. Knapp
***********************************************************************
"To understand is hard. Once one understands, action is easy."
-- Sun Yat-sen, Chinese statesman (1866-1925)
***********************************************************************
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Mike Wahler" <mkwahler@mkwahler.net>
Date: 2000/05/24 Raw View
Thomas R. Knapp <tom.knapp@ipix.com> wrote in message
news:392A9C47.CBAF0161@ipix.com...
> I have a question regarding function declaration as used in MS Windows
> programming. An example is:
>
> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
>
> I understand that the return value is of type "LRESULT". What I am a
> bit puzzled about is the term "CALLBACK". This line is compiled
> properly by MS Visual C++. Is the inclusion of the "CALLBACK" term
> peculiar to the Visual C++ compiler, or is this standard C and/or C++?
> Microsoft documentation indicates that this term specifying the way the
> parameters are put on the stack.
>
> My basic question is this - is this standard C and/or C++ or is it
> specific to Microsoft?
Microsoft specific.
-Mike
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: JimL <jludvik@eng.paradyne.com>
Date: 2000/05/24 Raw View
All declarations on the line:
"LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);"
are specific to microsoft. You will find all the UPPERCASE words to be
either typedefs or macros somewhere in the #include hierarchy.
"Thomas R. Knapp" wrote:
>
> I have a question regarding function declaration as used in MS Windows
> programming. An example is:
>
> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
>
> I understand that the return value is of type "LRESULT". What I am a
> bit puzzled about is the term "CALLBACK". This line is compiled
> properly by MS Visual C++. Is the inclusion of the "CALLBACK" term
> peculiar to the Visual C++ compiler, or is this standard C and/or C++?
> Microsoft documentation indicates that this term specifying the way the
> parameters are put on the stack.
>
> My basic question is this - is this standard C and/or C++ or is it
> specific to Microsoft?
>
> Thanks.
>
> --
> Best regards,
>
> Thomas R. Knapp
>
> ***********************************************************************
>
> "To understand is hard. Once one understands, action is easy."
> -- Sun Yat-sen, Chinese statesman (1866-1925)
>
> ***********************************************************************
>
> ---
> [ comp.std.c++ is moderated. To submit articles, try just posting with ]
> [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
> [ --- Please see the FAQ before posting. --- ]
> [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]