Gold mine of Visual C++ tricks!
- Announcements (6)
- C++ (31)
- Codeproject (106)
- COM (1)
- Compiler Extension (3)
- Debugging Tips (17)
- FileSystem (2)
- GDI & GDI+ (5)
- Glorious Bugs (3)
- MFC (22)
- Misc (2)
- Networking & Winsock (1)
- Polls (2)
- Preprocessors (3)
- Project settings (6)
- Uncategorized (47)
- VC++ Debugging Tips (1)
- Visual C++ (13)
- Visual C++ Preprocessors (1)
- Visual Studio (9)
- Visual Studio Tools (2)
- Windows APIs (35)
- Windows Shell Pearls (4)
#pragma #pragma comment array Breakpoint C++ catch(...) ColorHLSToRGB() ColorRGBToHLS() cout crash CRT Debugging exceptions exe File path FindFirstFile() functor gdi+ GetDlgCtrlID() handle hide file HLS Hue library macros memory leaks MINMAXINFO modules MoveFileEx name mangling new NTFS PathRemoveFileSpec() preprocessor Project settings SendMessage Shlwapi.h Shlwapi.lib STL unhandled exception VC++ Visual C++ Visual Studio Visual Studio 2008 watch window- March 2010 (1)
- February 2010 (7)
- November 2009 (2)
- October 2009 (3)
- July 2009 (1)
- June 2009 (1)
- May 2009 (2)
- April 2009 (2)
- March 2009 (9)
- January 2009 (7)
- December 2008 (12)
- November 2008 (5)
- October 2008 (6)
- September 2008 (2)
- August 2008 (13)
- July 2008 (17)
- June 2008 (24)
- May 2008 (29)
- April 2008 (33)
- March 2008 (20)
- February 2008 (1)
- Microsoft MVP for Visual C++ for 2009-2010 (16)
- Is it outlook, who composes your "New Message"? (12)
- Name Mangling – How to Undecorate a decorated C++ function name. (10)
- How to Parse Virtual Table? (9)
- How to import dialogs or resources from one project to another? (8)
- How to blink LED's in Keyboard? (8)
- Happy Birthday! WeSeeTips!!! (8)
- How to check whether current user have administrator privilege? (7)
- How to set title for your console application window. (7)
- How to Enable XP/Vista themes in your Dialog? (7)
Jijo Raj: Thanks for those kind words, Melvin! Best Regards, Jijo.
Jijo Raj: Ah! So It works fine. My pleasure. Thanks for sharing your experience, Nemesis. Best...
Jijo Raj: I want to show this comment to my wife and watch her reaction. ;) Cheers, Jijo.
Jijo Raj: Hi Bill, I'm happy to know that the tip was helpful! Best Regards, Jijo
Jijo Raj: Thanks Tom, for sharing the tip. :) Best Regards, Jijo.
Tom: The old MFC way (VC6) is AfxExtractSubString( result, source, tokennum, separator )
Bill New: This was extremely helpful. Thanks!
fantasy1215: from your expression, you are so kind a person in the real world!
Can C++ Style comments replace C-Style comments?
Apr 5th
Posted by Jijo Raj in C++
2 comments
While entering to C++ world, the first thing we used to learn is – Avoid C-Style comments, always use C++ style comments and a number of drawbacks of C-Style comments. But don’t think that C++ comments are omni. Still there are places where C++ style comments cannot be used.
Usually inside macros, we don’t write comments. But if the macro is too complex, adding comments will be better for future. But can we use C++ style comments? See the following code block.
#define CHECK_AND_DELETE_PTR( ptr ) \ // Check whether the pointer is valid \ if( ptr ) \ { \ // Delete the pointer \ delete ptr; \ }The code block won’t compile. Because C++ style comments always look for end-of-line as termination and the backslash delimiter that we add will concatenate the next line and that too will become the part of comment. Since macro body should be in a single line, we cannot omit the backslash delimiter.
See the same macro with C-Style comments which is perfect.
#define CHECK_AND_DELETE_PTR( ptr ) \ /* Check whether the pointer is valid */ \ if( ptr ) \ { \ /* Delete the pointer */ \ delete ptr; \ }Immortal C. Isn’t it?
Targeted Audience – Intermediate.