![]() Remember that the bytes occur in little-endian format. Because the long is 32-bits, it has become the obvious choice to use when needing to store pointers for Windows (a 32-bit OS). Negative numbers are represented using the “two’s complement” of the number. Thus, an integer is stored as 2 bytes, and has a range of -32,768 to 32,767. (This is true of a C++ integer.) But, it seems that somewhere along the line VB’s integer got stuck in the stone age and was cast in stone as a 16-bit number. So, traditionally, on a 16-bit architecture an integer is 16 bits, on 32-bit OS it is 32 bits, and so forth. ![]() Traditionally, an integer is defined as one “word” of an operating system. IntegerĪn Integer in VB is defined in a most unfortunate fashion. ![]() However, it should be noted that any non-zero value is also interpreted as TRUE. I think it stems from legacy 16-bit computer architecture.)Ī FALSE in boolean is stored as 0 (in other words, all bits are 0).Ī TRUE in boolean is stored as -1 (in other words, all bits are 1). (In actual fact, you could get away with using only 1 bit, so 2 bytes is, in my opinion, overkill. BooleanĪ boolean variable is represented by 2 bytes. Note: Bytes can’t be used to represent negative numbers (at least, not directly). ByteĪ byte is simply a single byte of memory-8 bits. The following data types are all pretty simple in how they are stored: Byte, Boolean, Integer, and Long. A few UNIX systems use big-endian format. Most operating systems (for example, DOS and all versions of Windows (so far)) are designed to run using little-endian format. In big-endian format, a multi-byte value is stored in memory from the highest byte (the “big end”) to the lowest.įor example, the value 0x12345678 is stored, in big-endian format, as shown here: 0x12 In little-endian format, a multi-byte value is stored in memory from the lowest byte (the “little end”) to the highest.įor example, the value 0x12345678 is stored, using little-endian format, as shown here. In a 32-bit operating system (for example, Win 95 and Win NT), the size of the pointer is 32 bits (4 bytes) and has a range of 0 to 4,294,967,296 (approx 4 Gigs).īTW: In a few years, when memory sizes exceed 4 Gig, we are going to need new 64-bit operating systems. But, briefly put, a pointer is a block of memory that stores a value of memory location where some other data exists. There is no way I can explain the intricacies of pointers here. These are all marked with BTW (by the way). This article describes how VB stores Bytes, Boolean, Integer, Long, Single, Double, Strings ( Fixed- and Variable-Length), Currency, Date, Variants, Arrays, and UDTs.īTW: I have put in a few points of interest.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |