| | |
Macro conventions
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
I know this is a slightly esoteric question, but I'm just curious how you guys define your function macros. Do you put a semicolon at the end or not?
For example:
In the first case, the advantage is that you don't have to type a semicolon in the actual code
EVENT_RESIZE(event)
which mean it's immediately obvious that it's a macro. I know Microsoft like to do it like this sometimes..
The second scenario requires a semicolon in the actual code
EVENT_RESIZE(event);
which means it behaves more like a standard function..
Anyway I know this is a kind of stupid question, but we have to design a bunch of SDL macros to standardise our code templates and I'm just curious which is the accepted convention.
Cheers,
For example:
C++ Syntax (Toggle Plain Text)
#define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey); // or #define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey)
In the first case, the advantage is that you don't have to type a semicolon in the actual code
EVENT_RESIZE(event)
which mean it's immediately obvious that it's a macro. I know Microsoft like to do it like this sometimes..
The second scenario requires a semicolon in the actual code
EVENT_RESIZE(event);
which means it behaves more like a standard function..
Anyway I know this is a kind of stupid question, but we have to design a bunch of SDL macros to standardise our code templates and I'm just curious which is the accepted convention.
Cheers,
![]() |
Similar Threads
- macro to make excel close (Visual Basic 4 / 5 / 6)
- Macro in Excel? (Windows Software)
- Macro Media Flashplayer 7 popups (Windows NT / 2000 / XP)
- Macro Problems (Windows Software)
- Excel Macro using vba :( (Visual Basic 4 / 5 / 6)
- Trying to run Showcase thru a Macro built in VB (Visual Basic 4 / 5 / 6)
- Using x86 Assembly Language with Microsoft Visual C++ (C++)
- Need help with including C++ code in Word macro (C++)
Other Threads in the C++ Forum
- Previous Thread: error C2664: 'strcpy' : cannot convert parameter 2 from 'const char' to 'const char *
- Next Thread: file IO and fuctions
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






