J
Jack
I want to write code that can be compiled as C and C++. In the Windows
API, there are many macros that help with scope resolution. For
example:
#ifdef __cplusplus
#define SNDMSG ::SendMessage
#else
#define SNDMSG SendMessage
#endif
If compiled as C++ code, the scope resolution operator is used. I can
see how that can be useful in some circumstances, but I don't think I
need it for my particular situation. But I don't know, that's why I'm
posting.
I'm writing some simple wrappers in the following form:
// MyWrappers.h
#ifdef __cplusplus
extern "C"
{
#endif
__inline int MyWrapper()
{
// Global function: Any need for scope resolution operator?
return (int)SendMessage( NULL, WM_USER, 0, 0 );
}
#ifdef __cplusplus
extern "C"
}
#endif
// eof
Is there any situation where not using the scope resolution operator
would cause problems?
Thanks,
Jack
API, there are many macros that help with scope resolution. For
example:
#ifdef __cplusplus
#define SNDMSG ::SendMessage
#else
#define SNDMSG SendMessage
#endif
If compiled as C++ code, the scope resolution operator is used. I can
see how that can be useful in some circumstances, but I don't think I
need it for my particular situation. But I don't know, that's why I'm
posting.
I'm writing some simple wrappers in the following form:
// MyWrappers.h
#ifdef __cplusplus
extern "C"
{
#endif
__inline int MyWrapper()
{
// Global function: Any need for scope resolution operator?
return (int)SendMessage( NULL, WM_USER, 0, 0 );
}
#ifdef __cplusplus
extern "C"
}
#endif
// eof
Is there any situation where not using the scope resolution operator
would cause problems?
Thanks,
Jack