Skip to main content
gamedev.net
🔒 Locked

Names for data types

Started by Khaos 12 replies 450+ views
Original Post
Khaos
Khaos
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.
rypyr
rypyr
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 ]
Densun
Densun
I would make defines or typedefs such as s08, u08, s16, u16, and so on. s08 would be signed 8-bit (char), u08 would be unsigned 8-bit. I saw some pro programmer do that once, so I started to, too. But I''m not a programmer anymore, so I don''t know if that''s a good idea.
Raduprv
Raduprv
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]
Khaos
Khaos
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.
trzy
trzy
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
----Bart
Oluseyi
Oluseyi
quote:
Original post by Khaos
I want to know the more accurate terms for 8-bit, 16-bit, 32, 64, 128, or higher data types.
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).

There are no "standards." Sorry.
Khaos
Khaos
So I have to use a number, such as int8, int16, etc.?

Also, what is the difference between floating point and fixed point? What would be good names for difference sizes of those numbers?
RuneLancer
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.
rypyr
rypyr
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 ]
DukeAtreides076
DukeAtreides076
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]
Conner McCloud
Conner McCloud
quote:
Original post by rypyr
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

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
23yrold3yrold
23yrold3yrold
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 2d4 fire damage.
smart_idiot
smart_idiot
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.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.