| Mirage Source http://miragesource.net/forums/ |
|
| Data Types - Visual Basic 6 and C++ http://miragesource.net/forums/viewtopic.php?f=210&t=728 |
Page 1 of 1 |
| Author: | Obsidian [ Tue Nov 07, 2006 10:53 pm ] |
| Post subject: | Data Types - Visual Basic 6 and C++ |
These are the listed data types that can be used, their ranges (minimum and maximum values), and how many bytes they use: Type: Byte Bytes Used: 1 Range: 0 to 255 Type: Integer Bytes Used: 2 Range: – 32,768 to 32,767 Type: Long Bytes Used: 4 Range: – 2,147,483,648 to 2,147,483,647 Type: Single Bytes Used: 4 Range: – 3.402823E38 to – 1.401298E – 45 (negative values) 1.401298E – 45 to 3.402823E38 (positive values) Type: Double Bytes Used: 8 Range: – 1.79769313486231E308 to – 4.94065645841247E – 324 (negative values) 4.94065645841247E – 324 to 1.79769313486231E308 (positive values) Type: Currency Bytes Used: 8 Range: 922,337,203,685,477.5808 to 922,337,203,685,477.5807 Type: String Bytes Used: String Length Range: Zero to approximately two billion characters Type: Variant Bytes Used: 16 bytes, plus 1 byte for each character if a string value. Range: Date values: January 1, 100 to December 31, 9999 Numeric values: same range as Double String values: same range as String Can also contain Error or Null values Type: Boolean Bytes Used: 2 Range: True or False Type: Date Bytes Used: 8 Range: January 1, 100 to December 31, 9999 Type: Object Bytes Used: 4 Range: Any "Object" Reference I thought these would be useful to anyone writting code, or trying to better understand how vb handles different memory values with the different data types available. Enjoy |
|
| Author: | Clu [ Wed Nov 08, 2006 12:07 am ] |
| Post subject: | |
cool, thx obs, I hadnt heard of Currency, or Date ones lol |
|
| Author: | Lea [ Wed Nov 08, 2006 12:17 am ] |
| Post subject: | |
Now here's a question for you. Why use a boolean variable, when they take two bytes, and you only need one bit to effectively store a true/false condition? Use a Byte instead. If you're good, you can use all 8 bits in the byte to store 8 seperate booleans. Woot |
|
| Author: | Misunderstood [ Wed Nov 08, 2006 12:43 am ] |
| Post subject: | |
Dave wrote: Now here's a question for you.
Why use a boolean variable, when they take two bytes, and you only need one bit to effectively store a true/false condition? Use a Byte instead. If you're good, you can use all 8 bits in the byte to store 8 seperate booleans. Woot Convenience, sometimes you don't need to worry about the memory. |
|
| Author: | Obsidian [ Wed Nov 08, 2006 1:07 am ] |
| Post subject: | |
can someone sticky and/or move this to the Knowledge base forum for future reference? |
|
| Author: | William [ Thu Jan 11, 2007 12:50 pm ] |
| Post subject: | |
|
|
| Author: | grimsk8ter11 [ Thu Jan 11, 2007 8:39 pm ] |
| Post subject: | |
Those aspiring to port to C++ or just learn it: char Character or small integer. 1 byte signed: -128 to 127 unsigned: 0 to 255 short int (short) Short Integer. 2bytes signed: -32768 to 32767 unsigned: 0 to 65535 int Integer. 4bytes signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295 long int (long) Long integer. 4bytes signed: -2147483648 to 2147483647 unsigned: 0 to 4294967295 bool Boolean value. It can take one of two values: true or false. 1byte true or false float Floating point number. 4bytes 3.4e +/- 38 (7 digits) double Double precision floating point number. 8bytes 1.7e +/- 308 (15 digits) long double Long double precision floating point number. 8bytes 1.7e +/- 308 (15 digits) wchar_t Wide character. 2bytes 1 wide character void No associated datatype (accepts any type) |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|