- Jun 27, 2002
- 2,908
- 0
- 76
I hate VB. Let's get that straight. I prefer C++ on a Linux/Unix platform.
VB usually shouldn't be in the "highly technical" section, but read on. I'm forced to use VB for a college course I'm taking. (The Microsoft addicts at my university refuse to use open source software.)
I'm writing a text editor. This is code that will go in txtEdit_Change() to note that changes were made. A form-level boolean will be used later to either ask the user if he/she wants to quit without saving or to let him/her go on their way.
Which statement is more efficient?
'Statement A
If (blnChangesSaved = True) Then blnChangesSaved = False
'Statement B
blnChangesSaved=False
Namely, is a test on a boolean variable faster than setting a boolean variable? Yeah, this almost doesn't matter, but I'm obsessed with efficiency. Note that this boolean will normally be false about 99% of the time.
We DO have a programming forum, you know.
AnandTech Moderator
VB usually shouldn't be in the "highly technical" section, but read on. I'm forced to use VB for a college course I'm taking. (The Microsoft addicts at my university refuse to use open source software.)
I'm writing a text editor. This is code that will go in txtEdit_Change() to note that changes were made. A form-level boolean will be used later to either ask the user if he/she wants to quit without saving or to let him/her go on their way.
Which statement is more efficient?
'Statement A
If (blnChangesSaved = True) Then blnChangesSaved = False
'Statement B
blnChangesSaved=False
Namely, is a test on a boolean variable faster than setting a boolean variable? Yeah, this almost doesn't matter, but I'm obsessed with efficiency. Note that this boolean will normally be false about 99% of the time.
We DO have a programming forum, you know.
AnandTech Moderator
