No it doesn't. The compiler removes the names and replaces them with a reference to a memory location. So no matter how big or small the name is, it still resolves to a memory location once it's compiled.
If you're running in the IDE or you compile your code with Symbolic Debug Info, it might have a slight effect. But I can't say for sure.
From the VB-Helper site:
Use comments and meaningful variable names. Long comments and variable names, and blank lines do not add to the compiled program's size so there is no harm in using them.
Here's some good performance techniques to use. The line above was taken from the link below:
I think it's 64. Here's something interesting I found rooting around for the answer.
The amount of code that can be loaded into a form, class, or standard module is limited to 65,534 lines. A single line of code can consist of up to 1023 bytes. Up to 256 blank spaces can precede the actual text on a single line, and no more than twenty-five line-continuation characters ( _) can be included in a single logical line. Snaggs
tribesaddict@swbell.net
There are two kinds of people in life: people who like their jobs, and people who don't work here anymore.
Variable names in Visual Basic can be no longer than 255 characters, and the names of forms, controls, modules, and classes cannot be longer than 40 characters. Visual Basic imposes no limit on the actual number of distinct objects in a project.
These and other specifications or limitations can be found at:
From the above comments it should be clear that using long variable names is OK to do. Moreover, it is reccomended since someone debugging later will have a better chance of figuring out what is going on. The only issue has to do with spelling errors. When using long variable names, it may become an issue. The longer the variable, the more likely you or someone else will misspell. Joseph Logan
Softsource, Inc.
Software Engineer
jlogan@softsource.net
RE: misspelling variables. As long as you always "Require Variable Declarations" by including Option Explicit in the Gen Declarations section of every module, misspelling variable names becomes a very minor problem. Each one is flagged as a compile error as soon as it's encountered.
"Option Explicit" keeps many a headache from ever occuring!
First thing you should do after installing VB is set the "Require Variable Declaration" flag on. I think that Microsoft did a big disservice to VB programmers by shipping VB with it turned off.
Descriptive variable names will be more effective if you stick to certain standards such as Hungarian notation or a consistent style in your names like consistent Noun-Verb order such as RecordAdd, InterestCalc, ParametersSet.
You may prefer Verb-Noun order e.g. AddRecord, CalcInterest, SetParameters.
One annoying aspect I find in coding is trying to remember the exact spelling of my variables and I often have to browse through the code to get it right. Following a consistent style helps me to deduce the correct name without having to look it up.
Microsoft is strange. If it limited control names to 40 characters, why did it limit control property names to 30 characters?
Not that I try to come up with long, descriptive control property names very often... I just find it perplexing that Microsoft was able to find yet another way to yank my chain.
Alt255@Vorpalcom.Intranets.com
"If you can get people to ask the wrong questions, they'll never find the right answers."[tt]
Thomas Pynchon[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.