|
I hate #if 0 . It's not so bad if the code commented out is small, but when large pieces of code are bracketed with these you can find yourself analyzing code only to find, when you get to the top, that you've been wasting your time and the code isn't even part of the product. This has happened to me many times. If the programmer simply commented it out the syntax highlighting will stop such problems from ever occurring.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I hate #if 0
me too.
i use this purpose instead...
#ifdef DEBUG
#define DPRINT printf
#else
void DPRINT(...) {}
#endif
this way, in debug mode, we could DPRINT() something, which will not been took in account in release mode (and more, the compiler will optimize a call to DPRINT() in release).
for instance :
int Foo() {
DPRINT("Foo()\n");
int i = 654;
DPRINT("Foo output : %d\n", i);
return i;
}
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
you can #if 0 the code which needs to be ignored in both debug and release build, i.e. older logic to solve a problem, etc.
-Prakash
|
|
|
|
|
Yes steve u r definetly correct. But this is not supposed to be used to large chunks of code. it is more of an debugging approach than just saving old code.
Tip: Always it is a good option to try to put a breakpoint to know if this code is compiled or not. a breakpoint cannot be inserted in any code that is not compiled.
Hope this helps.
kvprasad
your future is what you think
|
|
|
|
|
Stephen Hewitt wrote: If the programmer simply commented it out...
But nested comments are not allowed. That's where #if 0 is of use.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
|
I agree that large blocks of #if 0 'd code are annoying but VS2005 improves things a lot by greying it out. It even greys out (for example) #ifdef _DEBUG blocks when _DEBUG is not defined.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I believe that in Visual C++ 6.0 there is a key combination that will take you to / from
#if
and
#endif
but Microsoft in their 'wisdom' removed this very handy functionality from VC++.NET 2001. Yes, thanks Microsoft...
Personally, when I need to comment out large chunks of code, I use
#if defined dfkagtljarogh
#end if // defined dfkagtljarogh
where dfkagtljarogh is the result of some random keystrokes. Copy and paste to make sure that two instances match, and then it is not too bad to use Find to jump from beginning to end or vice versa.
And as for being unable to nest /* ... */ comments in C++, this is an abomination that should never have been put into the language. Is there any reason whatsoever why C++ (or C even) HAVE TO REFUSE to allow such useful nested comments?
Thanks again, Microsoft. Some C++ compilers do allow this.
Shraddhan
|
|
|
|
|
Shraddhan wrote: And as for being unable to nest /* ... */ comments in C++, this is an abomination that should never have been put into the language. Is there any reason whatsoever why C++ (or C even) HAVE TO REFUSE to allow such useful nested comments?
yes i agree with you and that is one thing that I hate in VC++ compiler.
-Prakash
|
|
|
|
|
|
|
I have small webserver which is able to handle html files only by default. But now I need to enable it to process ASP page. Is it possible or is any component available ?
|
|
|
|
|
which webserver are you talking about ?
it would depend if that webserver has support for ASP or has plugins to process ASP.
IIS has ASP engine that can be installed to process ASP.
-Prakash
|
|
|
|
|
I have source code of a simple web server. So I have my own web server. Now I want my web server to process ASP coding. I should not install IIS/PWS.
|
|
|
|
|
Like I said your new webserver should provide a plugin to process the ASP script.
like you said it is a simple webserver, it has probably just implemented the HTTP protocol, i.e. deliver the content on clients request.
-Prakash
|
|
|
|
|
I am trying to develop custom visualizers for native code in Visual Studio 2005. As I understand they were available for native code in beta's but were removed from release version.
So I am thinking to add a custom menu in code window contextmenu, hook with debugger, get the data for selected variable, identify type using RTTI or provide a dialog where user can enter types and then render it. Is this approach fesiable?
Another problem I have is there is not enough documentation for extending VS IDE using native code. So right now I am not even able to add a context menu on right click. I can see the menu I am trying to add sometimes but add-in always crashes. I tried articles on CP and none of them added a context menu in native code. Any pointers or advice for articles or samples will be much appreciated.
thanks,
-Saurabh
|
|
|
|
|
I have tried a product called 'Visual Watch' which provides such functionalities. But it doesn't support VS 2005 yet.
|
|
|
|
|
does it support adding user defined classes or structures.
thanks,
Saurabh
|
|
|
|
|
I have 10 button controls, when iam changing the back ground color of the main window, all the button controls in the main window are not visible, My question is How ro make the transparent back ground so that all the button controls should be visible..
Please send me if any ....its very urgent..
|
|
|
|
|
S_a_n wrote: when iam changing the back ground color of the main window
How are you changing the background color of the main window.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
with the help of FillRect() function..by getting the DC and rectangle of the main window...
|
|
|
|
|
S_a_n wrote: with the help of FillRect() function
Aha,
Here is the problem. Don't do background erasing like that.
Do background erasing in WM_ERASEBKGND handler. And return TRUE after you finish.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Could you plz send any sample code...by creating one button in the main window...and changing the background of the main window into transparent....so that the button will visible?
|
|
|
|
|
|
But with this we are not getting any background color intially..bcz whenevr BiginPaint() in WM_PAINT is called the WM_ERASEBKGND is sent to the main window..But i need one initial color at the starting i.e LTGRAY_BRUSH
|
|
|
|