|
VB Decompiler Hosted by TheAutomaters.com
|
Author |
Message |
Anonymous New User
Joined: 10 Feb 2008 Posts: 0
|
Posted: Sat Feb 28, 2004 5:21 am
Post subject: Variables' data types
|
|
Is there any way to get the variables' data types and a procedure's arguments' data types? Does VB store this information in the compiled .exe or you just have to "guess" the variables' data types based on the way they are used?
|
|
Back to top |
|
|
|
sarge Moderator
Joined: 24 Sep 2002 Posts: 194
|
Posted: Sat Feb 28, 2004 3:18 pm
Post subject:
|
|
A few items that may help:
1. When you declare a variable type ("Dim X as Double"), you are informing the compiler of the limits of the numeric value that X can be equated to, you are NOT instantiating X as a certain number of bytes of data.
2. VB will "cast" data down to the lowest possible data type
3. The PCode that manipulates that particular variable will give you a valuable clue, as different Pcodes are used for different data types; for example, F5 loads a 4 byte data value, which in VB is a Double.
So, you might think that something like this:
Dim X as double
x = 5
would result in 4 bytes of data being used, and thus the data would be :
0x00 0x00 0x00 0x05
but that's not what happens. At run time, VB will see a "5" and consider X to be a Byte (remember, VB casts down). So, it's really 0x05.
Now, it is entirely possible that the next PCode, maybe E4,EC,70 or 74, for example, will sign extend (or not) the value of 5 as needed for, say, some up-coming math operations, but it will not let the value of X exceed that of a Double.
This is a somewhat simplified description; I can give you more in-depth details if you have a more specific question about a particular code sequence.
Sarge
|
|
Back to top |
|
|
|
golem Often here
Joined: 18 Nov 2002 Posts: 73
|
Posted: Sat Feb 28, 2004 5:37 pm
Post subject: PGuerra's questions seemed pretty specific to me! :)
|
|
Maybe you should have ACTUALLY answered his questions, non? How much more SPECIFIC could PGuerra be than to actually ask how data type information is stored and how do you type a procedures variables, presumably both local and incoming?
LOL...
Carry on!
golem
|
|
Back to top |
|
|
|
Anonymous New User
Joined: 10 Feb 2008 Posts: 0
|
Posted: Sat Feb 28, 2004 6:25 pm
Post subject:
|
|
"...F5 loads a 4 byte data value, which in VB is a Double."
I thought a Double was 8 bytes long...
|
|
Back to top |
|
|
|
golem Often here
Joined: 18 Nov 2002 Posts: 73
|
Posted: Sun Feb 29, 2004 9:24 pm
Post subject: Do these subject headings even display? :)
|
|
PCode F5 xx xx xx xx is considered an I4 (therefore a Long )... at least in golems_Folly.
I presume that Sarge was actually talking about a variation of the focus of your question...
E4->CI2I4
EC->CR8I4
70->FStI2
74->FStFPR8
based on the OpCodes he mentioned. I would venture to guess his comments would have made more sense if he had demonstrated a block of actual PCode and compared it to the original source code to underline the point he was making about 'type' and the impact certain OpCodes in determining their type.
Carry on!
golem
|
|
Back to top |
|
|
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|