-
Oct 12th, 2017, 03:54 PM
#1
Thread Starter
Fanatic Member
Last edited by stuck-n-past; Oct 12th, 2017 at 04:12 PM.
-
Oct 12th, 2017, 04:16 PM
#2
Re: Compiled Debug Statments
Debug.Print compiles as a method call.
While the compiler might detect them and omit them, it is probably more effective and less work to just go ahead, evaluate the arguments, and have the method call do nothing when called in the normal runtime vs. the IDE runtime.
-
Oct 12th, 2017, 05:38 PM
#3
Thread Starter
Fanatic Member
Re: Compiled Debug Statments
That certainly appears to be what's happening as it's definitely executing code which is part of the Debug.Print statement. While it might not be outputting the text, it's still expending work as it processes the arguments.
I have always made the assumption that there was no concern in leaving Debug statements in my code, thinking they were completely removed by the compiler. I'm going to have to rethink things where once assuming there was no performance impact by leaving them in place, but now knowing that's not the case.
I'll be double checking to make sure all of my Debug statements are removed or commented out, which I usually do, but never placed much concern in doing so thinking it wasn't too important either way - Not so anymore!
-
Oct 13th, 2017, 04:15 AM
#4
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
I have always made the assumption that there was no concern in leaving Debug statements in my code, thinking they were completely removed by the compiler. I'm going to have to rethink things where once assuming there was no performance impact by leaving them in place, but now knowing that's not the case.
You do have to be wary when calling Debug.Print but you don't have to worry when using Debug.Assert.
Originally Posted by MSDN
Note When you compile your application into an .exe file, Debug.Print statements are removed. Thus, if your application only uses Debug.Print statements with strings or simple variable types as arguments, it will not have any Debug.Print statements. However, Visual Basic will not strip out function calls appearing as arguments to Debug.Print. Thus, any side-effects of those functions will continue to happen in a compiled .exe file, even though the function results are not printed. Read more...
Originally Posted by MSDN
A Debug.Assert statement will never appear in a compiled application, but when you're running in the design environment it causes the application to enter break mode with the line containing the statement highlighted (assuming that the expression evaluates to False). Read more...
Originally Posted by stuck-n-past
I'll be double checking to make sure all of my Debug statements are removed or commented out, which I usually do, but never placed much concern in doing so thinking it wasn't too important either way - Not so anymore!
Originally Posted by MSDN
If you do not want debugging statements included in the application you distribute to users, use conditional compilation to conveniently delete these statements when the Make EXE File command is used. Read more...
-
Oct 13th, 2017, 08:43 AM
#5
Thread Starter
Fanatic Member
Re: Compiled Debug Statments
Victor - Thank you very much for the Debug information.
I must apologize for posting such a question about Debug information when obviously it's all available on MSDN. While it might sound hard to believe, I do try searching for answers before posting questions here. I can't begin to tell you the amount of time I spend checking the Web. And that doesn't include the endless hours wasted getting sidetracked when other, not so relevant, VB information pops up. Don't even get me started when a search, heaven forbid, leads me to a YouTube link. I can get sucked into one video after another, and before I know it, my browser begins to slow from all of the open tabs.
I feel bad in asking a questions on the Forum, only to have others point out that the answers are out there for all to find and read. Clearly I suck at online research!
Thanks again for the info.
-
Oct 13th, 2017, 09:05 AM
#6
Re: Compiled Debug Statments
Clearly I suck at online research!
Google-Fu needs some work grasshopper.
Tip: more times than not, this is my favorite google search string: msdn vb6 [add function here]
Example: msdn vb6 debug.print. That link was 8th hit in my search, but typically I get the desired hits higher up in the list
Last edited by LaVolpe; Oct 13th, 2017 at 09:09 AM.
-
Oct 13th, 2017, 11:37 AM
#7
Re: Compiled Debug Statments
You should only feel bad if you didn't bother trying, otherwise the forum is perfect for when you can't find (or don't know how to search for) the answer.
-
Oct 15th, 2017, 08:10 PM
#8
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
Victor - Thank you very much for the Debug information.
I must apologize for posting such a question about Debug information when obviously it's all available on MSDN. While it might sound hard to believe, I do try searching for answers before posting questions here. I can't begin to tell you the amount of time I spend checking the Web. And that doesn't include the endless hours wasted getting sidetracked when other, not so relevant, VB information pops up. Don't even get me started when a search, heaven forbid, leads me to a YouTube link. I can get sucked into one video after another, and before I know it, my browser begins to slow from all of the open tabs.
I feel bad in asking a questions on the Forum, only to have others point out that the answers are out there for all to find and read. Clearly I suck at online research!
Thanks again for the info.
You're one step away from being me... I'll spend hours stuck on a problem, searching the web, digging through code samples, trying 1000 different things, then finally giving up and posting the question here... only to then immediately realize what was wrong and get it working
-
Oct 15th, 2017, 09:12 PM
#9
Thread Starter
Fanatic Member
Re: Compiled Debug Statments
fafalone - Right there with ya! I so hate it because I feel as I'm using the Forum when I should be able to find the problem myself and shouldn't be bothering other members. And I can't say enough about my internet nemesis YouTube, which has some mystical hypnotic power over me, drawing me in and never letting go.
-
Oct 16th, 2017, 08:42 AM
#10
Re: Compiled Debug Statments
We've all been there... there's been times that I don't see the answer until I'm clicking that "Create thread" button... I liken it to talking to someone in the office... sometimes that's all you need, is the chance to explain it, for your mind to work it out and see the answer that's right there. There are way more times I get half way through a post when I realize "duh... that's the answer right there...." and end up deleting the post than I do actually posting the post. Sometimes it's only post post posting that I see what's in front of me.
I believe it's known as the Rubber Duck Scenario.
-tg
-
Oct 16th, 2017, 09:19 AM
#11
Thread Starter
Fanatic Member
Re: Compiled Debug Statments
tg - I'd of never admitted it til now, but I too have positioned the mouse over the submit button ready to start a new thread only to stop a rethink things. Then after rereading my own words, I've scrapped the whole thing and heading back to my code.
Have to tell ya, never heard of the Rubber Duck Scenario before and how ironic, instead of asking what it meant I went searching for it.
The phrase refers to the fact that the very act of explaining the problem to someone reveals the solution without them having to say anything. So you could have explained the problem to anyone or anything, including a rubber duck.
That's one to remember.
One of the problems I've had in the past trying to research a problem is not knowing the proper terminology for the issue I'm dealing with. Sort of stops one dead in your tracks.
-
Oct 16th, 2017, 10:07 AM
#12
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
One of the problems I've had in the past trying to research a problem is not knowing the proper terminology for the issue I'm dealing with. Sort of stops one dead in your tracks.
That's a problem I've had in the past too... and one I'm certain a lot of noob developers have as well, which is why they come here looking for help with some of the basic questions - we've gotten ourselves conditioned to know the keywords to pick out and search with... the basic new developer likely isn't going to know how to do that. Doubly so given what I hear around here about some profs they have.
-tg
-
Oct 16th, 2017, 11:58 AM
#13
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
That's one to remember.
Indeed
-
Oct 16th, 2017, 03:53 PM
#14
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
...And I can't say enough about my internet nemesis YouTube, which has some mystical hypnotic power over me, drawing me in and never letting go.
lol, I tried to snag you, in post #6, by linking youtube in my reply. Sounds like you didn't take the bait
-
Oct 16th, 2017, 08:00 PM
#15
Thread Starter
Fanatic Member
Re: Compiled Debug Statments
Your a monster Lavolpe - lol!
I totally fell for the bait, hook-line and sinker! I was just too damn embarrassed to admit I followed the link and more .
I couldn't for the life of me understand why you included that particular video, so I chalked it up to programmer dementia and never would have brought the subject up. Now I know the devil's in the details, or in this case, in the YouTube links.
-
Oct 17th, 2017, 03:44 PM
#16
Re: Compiled Debug Statments
Originally Posted by stuck-n-past
I couldn't for the life of me understand why you included that particular video, so I chalked it up to programmer dementia
Just so you don't think it's dementia. I used the term "google-fu" in that post, which has its origin from "kung-fu". The popular U.S. TV series Kung-Fu leading character was known as grasshopper in his youth. Tip: The link above is not youtube
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|