🔒 Locked
Names for data types
Advertisement
Original Post
Does anyone know of generic, more computer science based names for data types (sizes)?
For instance, I do not want:
int, short, long, double, w_char, etc.
Those apply more to compilers and IDEs. I want to know the more accurate terms for 8-bit, 16-bit, 32, 64, 128, or higher data types.
I know of the byte, word, dword, qword... are those right? How much higher do they go? Are there other names that are equally generic to describe data type sizes? How far do those continue, beyond 64 bits... what are their names?
I simply want to use names that describe data type sizes.. but are not specific to a compiler. It''s part of a program, but I don''t want the user to say: "Hey, how big is a short?" or similar. Any more standardized names for data sizes?
Thanks.
quad-word is as far as I have heard in regular conversation, though I assume oct-word or octo-word will be next (128-bit).
Personally I like to use:
Uint8
Uint16
Uint32
Uint64
int8
int16
int32
int64
Typedef those in a header file and include it in any project you''re in and it''s very clear.
Regards,
Jeff
[ CodeDread ]
Personally I like to use:
Uint8
Uint16
Uint32
Uint64
int8
int16
int32
int64
Typedef those in a header file and include it in any project you''re in and it''s very clear.
Regards,
Jeff
[ CodeDread ]
I also use
Uint8
Uint16
Uint32, because they are provided by SDL, and I always used SDL in my projects. But for strings I use char, and if I am lazy I use int for 32b variables. However, using int when you expect an unsigned int can be a source of many problems...
[edited by - Raduprv on May 15, 2004 1:50:45 PM]
Uint8
Uint16
Uint32, because they are provided by SDL, and I always used SDL in my projects. But for strings I use char, and if I am lazy I use int for 32b variables. However, using int when you expect an unsigned int can be a source of many problems...
[edited by - Raduprv on May 15, 2004 1:50:45 PM]
Any words though, with no numbers? I did think of that, and I wanted to use them, but I thought it would look confusing.
uint08 x = 80;
I simply don''t like the look of numbers so close together, although that explicitness was what I was indeed looking for. Is saying byte, word, dword, qword, and oword as close as I am going to get? I still think even those are slightly ugly.
I like how beautiful byte, short, int, long.. all look. They simply are too esoteric to a given compiler.
No other standards?
Thanks for your replies though.
uint08 x = 80;
I simply don''t like the look of numbers so close together, although that explicitness was what I was indeed looking for. Is saying byte, word, dword, qword, and oword as close as I am going to get? I still think even those are slightly ugly.
I like how beautiful byte, short, int, long.. all look. They simply are too esoteric to a given compiler.
No other standards?
Thanks for your replies though.
quote:
Original post by Khaos
I know of the byte, word, dword, qword... are those right? How much higher do they go? Are there other names that are equally generic to describe data type sizes? How far do those continue, beyond 64 bits... what are their names?
They aren''t "right" because they''re completely processor-specific. A "word" is usually related to the data size a processor operates on. X86 was originally 16-bit, so a "word" was 2 bytes. But the situation is different on PPC, for example, where 16 bits is a half-word and 32 bits is a word.
quote:
I simply want to use names that describe data type sizes.. but are not specific to a compiler. It''s part of a program, but I don''t want the user to say: "Hey, how big is a short?" or similar. Any more standardized names for data sizes?
In this case, use what others have suggested: UINT8, UINT16, INT32, etc.
----
Bart
quote:You mean bit, nybble (or nibble), byte, word, doubleword and quadword? Their sizes, other than bit, are all basically architecture dependent. There are systems with 12-bit bytes, and the word size on Alpha, Athlon64, Itanium/IA-64 and other 64-bit systems is 64-bits, whereas a word is 32-bits on 32-bit architectures (ie, word size defines architecture classification).
Original post by Khaos
I want to know the more accurate terms for 8-bit, 16-bit, 32, 64, 128, or higher data types.
There are no "standards." Sorry.
Floating point and fixed point differ in the placement of the point.
35.66
0.3566
356.6
3.566
35660
That''s floating point. I used the same digits to illustrate it more clearly.
356.44
003.14
971.11
001.01
That''s fixed point. The 0 are there for padding and to illustrate more clearly how the point never moves around.
35.66
0.3566
356.6
3.566
35660
That''s floating point. I used the same digits to illustrate it more clearly.
356.44
003.14
971.11
001.01
That''s fixed point. The 0 are there for padding and to illustrate more clearly how the point never moves around.
quote:
Original post by RuneLancer
Floating point and fixed point differ in the placement of the point.
35.66
0.3566
356.6
3.566
35660
That''s floating point. I used the same digits to illustrate it more clearly.
356.44
003.14
971.11
001.01
That''s fixed point. The 0 are there for padding and to illustrate more clearly how the point never moves around.![]()
I''m not sure if this is a joke or not. Floating/fixed point has nothing to do with the placement of the decimal. It refers to how the number is stored internally. Floating point uses x digits for the mantissa and y digits for the exponent. Fixed point uses all digits for the number and the "decimal" point is fixed (i.e. if I have a 32-bit floating point number, the top 16 bits could be the "whole" number (or integer) portion and the bottom 16-bits could be the fraction).
Regards,
Jeff
[ CodeDread ]
In addition there is the double quadword, 128 bits on IA-32 architecture processors.
[edited by - DukeAtreides076 on May 15, 2004 4:35:18 PM]
[edited by - DukeAtreides076 on May 15, 2004 4:35:18 PM]
quote:
Original post by rypyrquote:
Original post by RuneLancer
Floating point and fixed point differ in the placement of the point.
35.66
0.3566
356.6
3.566
35660
That''s floating point. I used the same digits to illustrate it more clearly.
356.44
003.14
971.11
001.01
That''s fixed point. The 0 are there for padding and to illustrate more clearly how the point never moves around.![]()
I''m not sure if this is a joke or not. Floating/fixed point has nothing to do with the placement of the decimal. It refers to how the number is stored internally. Floating point uses x digits for the mantissa and y digits for the exponent. Fixed point uses all digits for the number and the "decimal" point is fixed (i.e. if I have a 32-bit floating point number, the top 16 bits could be the "whole" number (or integer) portion and the bottom 16-bits could be the fraction).
Regards,
Jeff
You both just said the same thing.
Personally, I support ''Integer'' for integer values and ''Float'' for floating point values. If you happen to be on a system where fixed point math is needed, then they would get lumped into Float. If you insist on caring how large the data is, then run with intN notation. Even if there were a standard notation that doesn''t rely on numbers, using it would still cause confusion. You don''t know what it is, so the safest bet is to assume nobody else does either.
CM
Isn''t there a standard header for this stuff already? stdint.h or something?
Jesus saves ... the rest of you take damage.
"A page of history is worth a volume of logic." -- Oliver Wendell Holmes
Jesus saves ... the rest of you take damage.
"A page of history is worth a volume of logic." -- Oliver Wendell Holmes
Yes, stdint.h. It defines int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t, along with a bunch of other things.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement