Re: Inputbox Question
- From: "Al Reid" <areidjr@xxxxxxxxxxxxxxxx>
- Date: Fri, 8 Jul 2005 13:07:54 -0400
"Rick Rothstein" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in message news:%23Qb9%2359gFHA.2456@xxxxxxxxxxxxxxxxxxxxxxx
> > >> The only problem here is that using "" an place of vbNullString
> > >> does *NOT* result in any "Bloat." In fact, once compiled, they
> > >> both result in exactly the same executable. WinDiff sees no
> > >> difference in the executables, other than the file date.
> > >
> > > That is an incorrect assumption.
> > >
> > > Create a new project, add a command button to Form1, and add the
> > > following sub:
> > >
> > > Private Sub Command1_Click()
> > > Dim S As String
> > >
> > > S = ""
> > > End Sub
> > >
> > > Copy the "S=" line so that there are 100 of them. Compile to
> > > Project1.exe
> > >
> > > Then replace all literal zero-length strings with either
> vbNullString
> > > or with your own constant. Compile to Project2.exe.
> > >
> > > The file size of Project1.exe and Project2.exe is different by 4K.
> >
> > Not on my systems; the files are different but are the same size
> whether I
> > use vbNullString, my onw constant or "". I used native code optimized
> for
> > small code size with VB6 SP5.
>
> Are they the same number of physical bytes? Or are you just looking at
> the sector size that Windows Explorer reports? It seems that DenBorg's
> 4K difference is a sector size difference leading me to believe that the
> physical byte size of the files is, in fact, different.
>
> With that said... Who cares!
>
> The difference, if there really is one, under any or all compile
> conditions, has got to be so small as to be meaningless given the size
> of RAM and hard disks on current systems. Seems to me that it is time
> for this thread to end, no?
>
> Rick
>
>
Rick,
In my case, I used WinDiff to compare the files AND went as far as running a disassembler and comparing the code visually. They are
identical.
In the case of a boolean compare (a = "")' vs. (a = vbNullString) they both compare a to "0".
So as far as I can see, the compiler optimizes them both to the same machine code.
--
Al Reid
.
- Follow-Ups:
- Re: Inputbox Question
- From: J French
- Re: Inputbox Question
- References:
- Inputbox Question
- From: A P
- Re: Inputbox Question
- From: Michael Cole
- Re: Inputbox Question
- From: DenBorg
- Re: Inputbox Question
- From: Bob Butler
- Re: Inputbox Question
- From: DenBorg
- Re: Inputbox Question
- From: Bob Butler
- Re: Inputbox Question
- From: DenBorg
- Re: Inputbox Question
- From: Bob Butler
- Re: Inputbox Question
- From: DenBorg
- Re: Inputbox Question
- From: Al Reid
- Re: Inputbox Question
- From: DenBorg
- Re: Inputbox Question
- From: Bob Butler
- Re: Inputbox Question
- From: Rick Rothstein
- Inputbox Question
- Prev by Date: Re: Inputbox Question
- Next by Date: collection
- Previous by thread: Re: Inputbox Question
- Next by thread: Re: Inputbox Question
- Index(es):