Read / Write VBA

...I can't get a certain Access MVP to agree with me that Integers are processed as Longs:
http://www.access-programmers.co.uk/forums/showthread.php?p=724034
Dammit Nate, :nya: would it have friggin' killed ya to have posted that link before I posted :
Because once upon a time...memory mattered ...Because I will, on the rare occasion, use BYTE variables for items I know won't exceed values of 255.
So, what the dickens is the benefit of the BYTE type? Unless, perhaps to deliberately employ the value limitations as traps against unexpected values and the like? Is it just a legacy thing for backwards compatibility?

And for those of us who can barely find the time to stop by here, never mind visiting UA - do we have a thread here where you've gone into detail on that code where you guys were trying to get a bead on the memory footprint of the different variable types?
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
It probably wouldn't have killed me, Greg, but I've been off on holliday! :)

The beauty of the Byte Data Type? To understand the beauty of the Byte Type, you need to understand why it was created. Richard knows the answer to this one: String Operations.

That's the only time I ever use it, as a character array (Byte Array). Although this can be tricky. This Data type was actually created with this specific task in mind, not to just house numbers:

http://vb.mvps.org/hardcore/html/whatisunicode.htm

When Basic sees that you want to pass a string to an outside function, it conveniently squishes the internal Unicode strings into ANSI strings. But if the function expects Unicode, you must find a way to make Basic leave your 16-bit characters alone. The new Byte type was added specifically for those cases in which you don’t want the languages messing with data behind your back.

It's fast - really fast, for String Parsing in an Array context. Looks like I'm using it, correctly! :cool:

I can see using its limitations in a validation context as well, but also in a String context, limiting the input to a String that's to be built.

Happy new year! :)
 
Last edited:
And for those of us who can barely find the time to stop by here, never mind visiting UA - do we have a thread here where you've gone into detail on that code where you guys were trying to get a bead on the memory footprint of the different variable types?

Not that I know of, but we could start one. And I'm not 100% sure I trust that approach. I might tempted to test CopyMemory():

http://www.devx.com/vb2themax/Tip/18519

Against the Variable and see what gets moved given a certain number of Bytes. However, I can't be sure that what is stored as a certain size is processed in the same manner, without coercion, which is what the documentation appears to be saying.

I'm not sure if VB[A] can get low-enough, as a high-level language, to properly test this.

Edit: The thread at UA isn't much more insightful than the one I linked to, the only additional readings in the thread of use are a couple of MSDN links I provided which claim the Integer is coerced to a Long when it's processed.
 
Last edited:

Forum statistics

Threads
1,222,653
Messages
6,167,363
Members
452,111
Latest member
NyVmex

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top