digitalmars.D - Get rid of byte?
- Andrew Fedoniouk (15/15) Feb 16 2006 Strictly speaking 'byte' is a name of data storage unit and
- nick (26/42) Feb 17 2006 Since a definition is something that most people agree on, there isn't a
- Marco Matthies (19/30) Feb 17 2006 This ("smallest addressable unit") is not the definition of byte (e.g.
- S. Chancellor (5/14) Feb 17 2006 This is very common in cross platform C applications. Typdefs from the ...
- Walter Bright (4/22) Feb 17 2006 This is unnecessary in D, as ints are 32 bits everywhere. A typedef or o...
- Bruno Medeiros (8/34) Feb 18 2006 Still, it might be nice to have those types in the language, as aliases....
- Walter Bright (3/6) Feb 18 2006 import std.stdint;
- Jarrett Billingsley (4/10) Feb 18 2006 Could the _t suffix at least be taken off those aliases (alii?) ? int8_...
-
Walter Bright
(5/17)
Feb 18 2006
I agree it's ugly, but the names were taken from C's
. That make... - Jarrett Billingsley (8/11) Feb 18 2006 You could just change it altogether, since it's easy to globally search ...
- Marco Matthies (4/9) Feb 18 2006 Well here is one example: qemu. No doubt a bazillion C programs don't
- Walter Bright (6/8) Feb 19 2006 If it was changed, there'd inevitably be someone who thought it would be...
- Chris Miller (4/25) Feb 18 2006 Could deprecate them, and/or have them in std.c.stdint, and add ones
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (10/12) Feb 19 2006 It also appears on "size_t", the type of the array .length attribute...
- James Dunne (17/34) Feb 20 2006 FYI, the -i plural suffix only applies to words that end in 'us', not
- John C (11/44) Feb 20 2006 Call me a pedant (it wouldn't be the first time), but 'bus' is just one ...
- James Dunne (13/75) Feb 21 2006 Learn something new everyday. I did know 'bus' was short for something,...
- Georg Wrede (2/72) Feb 22 2006 So be it. Then you probably know the pluralis of 'sauna'.
- Jarrett Billingsley (4/8) Feb 20 2006 Ah!
- Bruno Medeiros (8/17) Feb 18 2006 Hum, interesting, didn't remember about that. Nice, but should also: not...
Strictly speaking 'byte' is a name of data storage unit and not a name of numeric type. And by definition it is smallest addressable unit by particular processor. ( Some DSP can address only 32bit bytes for example ) So word combinations "signed byte" and "unsigned byte" are technically incorrect. Ideally (mathematically correct) it should be something like int8, int16, int32, int64 and nat8, nat16, nat32, nat64 for "unsigned" real16, real32, real64, etc. At least 'byte' should be unsigned numeric type ("what is max number stored in byte?") as 'word' and 'dword'. Andrew Fedoniouk. http://terrainformatica.com
Feb 16 2006
Since a definition is something that most people agree on, there isn't a right and a wrong in these discussions. There is just consistent and inconsistent. For our purposes, a 'byte' and a 'ubyte' make sense because most people understand what those tokens mean; therefore they are consistent. Andrew Fedoniouk wrote:Strictly speaking 'byte' is a name of data storage unit and not a name of numeric type.True, but D is meant to be a systems language as well, in which case it needs to support low level access to data storage units present in hardware.And by definition it is smallest addressable unit by particular processor.( Some DSP can address only 32bit bytes for example )That's a less commonly accepted meaning of the word 'byte' and it usually used in more specific contexts. Generally people would say that a byte is 8 bits.So word combinations "signed byte" and "unsigned byte" are technically incorrect.I don't see why. Signed means the byte is treated as 2's complement and unsigned means it's not. I would be totally cool with the concept of a 'byte' being just 8 bits. However, I start getting crazy ideas like disallowing any arithmetic on bytes, since they are just collections of bits.Ideally (mathematically correct) it should be something like int8, int16, int32, int64 and nat8, nat16, nat32, nat64 for "unsigned" real16, real32, real64, etc.But computers != maths. A float is an IEEE754-compliant representation of a number; it's not really a 'real'. If it was a real it wouldn't have rounding errors and such. Below, I am just trying to illustrate that there is no end to being picky with definitions...At least 'byte' should be unsigned numeric type ("what is max number stored in byte?") as 'word' and 'dword'.The notion of a byte being a "data storage unit" means that technically there is no maximum number stored in a byte. Instead, we assign meaning to different configurations that a byte can take on (of which there are 256). For example, you could say 0xFF means 'infinity' or it can mean '42', or it can mean 'I <3 PONIES'.Andrew Fedoniouk. http://terrainformatica.com
Feb 17 2006
Andrew Fedoniouk wrote:Strictly speaking 'byte' is a name of data storage unit and not a name of numeric type.True.And by definition it is smallest addressable unit by particular processor. ( Some DSP can address only 32bit bytes for example )This ("smallest addressable unit") is not the definition of byte (e.g. certain architectures do not allow loads which are not 32-bit aligned and always load a 32-bit quantity but still have byte == 8 bits). Historically, it just meant tuple (or array if you want) of bits with an architecture dependent length (e.g. 6-bit bytes were the first used byte-size as the machines of long ago used 6-bit character sets). Well then was then and now is now, and nowadays everyone usually means "8 bits" when they say "byte".So word combinations "signed byte" and "unsigned byte" are technically incorrect. Ideally (mathematically correct) it should be something like int8, int16, int32, int64 and nat8, nat16, nat32, nat64 for "unsigned" real16, real32, real64, etc.I like your idea, here is my variation on it: int8, int16, int32, int64, int128 uint8, uint16, uint32, uint64, uint128 float32, float64, float80, float128 ifloat32, ifloat64, ifloat80, ifloat128 cfloat32, cfloat64, cfloat80, cfloat128 But you'd actually have to look at code containing lots of this -- perhaps it just turns out too ugly. Marco
Feb 17 2006
In article <dt5ba1$h5n$1 digitaldaemon.com>, Marco Matthies says...I like your idea, here is my variation on it: int8, int16, int32, int64, int128 uint8, uint16, uint32, uint64, uint128 float32, float64, float80, float128 ifloat32, ifloat64, ifloat80, ifloat128 cfloat32, cfloat64, cfloat80, cfloat128 But you'd actually have to look at code containing lots of this -- perhaps it just turns out too ugly. MarcoThis is very common in cross platform C applications. Typdefs from the types of a specific artitecture to these size style types so they don't have to remember what arch they're on everywhere. It doesn't look bad to me at all. -S.
Feb 17 2006
"S. Chancellor" <S._member pathlink.com> wrote in message news:dt5do3$jh1$1 digitaldaemon.com...In article <dt5ba1$h5n$1 digitaldaemon.com>, Marco Matthies says...This is unnecessary in D, as ints are 32 bits everywhere. A typedef or other reminder isn't necessary.I like your idea, here is my variation on it: int8, int16, int32, int64, int128 uint8, uint16, uint32, uint64, uint128 float32, float64, float80, float128 ifloat32, ifloat64, ifloat80, ifloat128 cfloat32, cfloat64, cfloat80, cfloat128 But you'd actually have to look at code containing lots of this -- perhaps it just turns out too ugly. MarcoThis is very common in cross platform C applications. Typdefs from the types of a specific artitecture to these size style types so they don't have to remember what arch they're on everywhere. It doesn't look bad to me at all.
Feb 17 2006
Walter Bright wrote:"S. Chancellor" <S._member pathlink.com> wrote in message news:dt5do3$jh1$1 digitaldaemon.com...Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up. -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."In article <dt5ba1$h5n$1 digitaldaemon.com>, Marco Matthies says...This is unnecessary in D, as ints are 32 bits everywhere. A typedef or other reminder isn't necessary.I like your idea, here is my variation on it: int8, int16, int32, int64, int128 uint8, uint16, uint32, uint64, uint128 float32, float64, float80, float128 ifloat32, ifloat64, ifloat80, ifloat128 cfloat32, cfloat64, cfloat80, cfloat128 But you'd actually have to look at code containing lots of this -- perhaps it just turns out too ugly. MarcoThis is very common in cross platform C applications. Typdefs from the types of a specific artitecture to these size style types so they don't have to remember what arch they're on everywhere. It doesn't look bad to me at all.
Feb 18 2006
"Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 18 2006
"Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com..."Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 18 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dt7q7f$2kfm$1 digitaldaemon.com..."Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...I agree it's ugly, but the names were taken from C's <stdint>. That makes it convenient for porting from C, and for those who like the C stuff. Having yet a third set of names would be a bit too redundant."Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 18 2006
"Walter Bright" <newshound digitalmars.com> wrote in message news:dt7uv8$2p0l$2 digitaldaemon.com...I agree it's ugly, but the names were taken from C's <stdint>. That makes it convenient for porting from C, and for those who like the C stuff. Having yet a third set of names would be a bit too redundant.You could just change it altogether, since it's easy to globally search and replace for intxx_t. Besides, how many C programs have you seen that _actually use the stdints_? It seems every open-source project out there has its own set of defines or typedefs to rename the types whatever they want, be it int8, byte, i8 or something else altogether. Of course, this is never going to change, so I'm not sure why I even bother.
Feb 18 2006
Jarrett Billingsley wrote:You could just change it altogether, since it's easy to globally search and replace for intxx_t. Besides, how many C programs have you seen that _actually use the stdints_? It seems every open-source project out there has its own set of defines or typedefs to rename the types whatever they want, be it int8, byte, i8 or something else altogether.Well here is one example: qemu. No doubt a bazillion C programs don't use stdint.h, but that is probably due to the fact it only appeared in C99. Marco
Feb 18 2006
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dt7vhe$2phg$1 digitaldaemon.com...Of course, this is never going to change, so I'm not sure why I even bother.If it was changed, there'd inevitably be someone who thought it would be a great idea to use the stdint.h names and who'd think ill of me for not making that change. There's no solution possible. At some point, it's time to just leave it be and move on to more interesting things.
Feb 19 2006
On Sat, 18 Feb 2006 14:59:42 -0500, Walter Bright <newshound digitalmars.com> wrote:"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message news:dt7q7f$2kfm$1 digitaldaemon.com...Could deprecate them, and/or have them in std.c.stdint, and add ones without _t to std.stdint."Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...I agree it's ugly, but the names were taken from C's <stdint>. That makes it convenient for porting from C, and for those who like the C stuff. Having yet a third set of names would be a bit too redundant."Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 18 2006
Jarrett Billingsley wrote:Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.It also appears on "size_t", the type of the array .length attribute... (that is similar to "uint" for 32-bit code and "ulong" for 64-bit code) So it's in D already :-) --anders PS. I liked the "std.stdutf" idea too, but it seems noone else did. alias char utf8_t; alias wchar utf16_t; alias dchar utf32_t;
Feb 19 2006
Jarrett Billingsley wrote:"Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...FYI, the -i plural suffix only applies to words that end in 'us', not 'as' or other variants. cactus -> cacti genius -> genii hippopotamus -> hippopotami Apparently, 'bus' is the exception to the rule. "Hey look at all those bi!" An interesting read: http://www.csse.monash.edu.au/~damian/papers/extabs/Plurals.html -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James Dunne"Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 20 2006
"James Dunne" <james.jdunne gmail.com> wrote in message news:dtdehf$2pu7$1 digitaldaemon.com...Jarrett Billingsley wrote:Call me a pedant (it wouldn't be the first time), but 'bus' is just one of many exceptions. corpus corpora viscus viscera platypus platypuses opus opera virus viruses (although see "Use of the virii form" at http://en.wikipedia.org/wiki/Viruses) Bus, of course, is short for omnibus, which in Latin was a plural anyway."Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...FYI, the -i plural suffix only applies to words that end in 'us', not 'as' or other variants. cactus -> cacti genius -> genii hippopotamus -> hippopotami Apparently, 'bus' is the exception to the rule. "Hey look at all those bi!""Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;An interesting read: http://www.csse.monash.edu.au/~damian/papers/extabs/Plurals.html -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James Dunne
Feb 20 2006
John C wrote:"James Dunne" <james.jdunne gmail.com> wrote in message news:dtdehf$2pu7$1 digitaldaemon.com...Learn something new everyday. I did know 'bus' was short for something, but I didn't know that. I'm not a fan of the -uses plural suffix. I prefer the -i plural. Platypus = platypi. It just sounds more natural to me. -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James DunneJarrett Billingsley wrote:Call me a pedant (it wouldn't be the first time), but 'bus' is just one of many exceptions. corpus corpora viscus viscera platypus platypuses opus opera virus viruses (although see "Use of the virii form" at http://en.wikipedia.org/wiki/Viruses) Bus, of course, is short for omnibus, which in Latin was a plural anyway."Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...FYI, the -i plural suffix only applies to words that end in 'us', not 'as' or other variants. cactus -> cacti genius -> genii hippopotamus -> hippopotami Apparently, 'bus' is the exception to the rule. "Hey look at all those bi!""Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;An interesting read: http://www.csse.monash.edu.au/~damian/papers/extabs/Plurals.html -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------ James Dunne
Feb 21 2006
James Dunne wrote:John C wrote:So be it. Then you probably know the pluralis of 'sauna'."James Dunne" <james.jdunne gmail.com> wrote in message news:dtdehf$2pu7$1 digitaldaemon.com...Learn something new everyday. I did know 'bus' was short for something, but I didn't know that. I'm not a fan of the -uses plural suffix. I prefer the -i plural. Platypus = platypi. It just sounds more natural to me.Jarrett Billingsley wrote:Call me a pedant (it wouldn't be the first time), but 'bus' is just one of many exceptions. corpus corpora viscus viscera platypus platypuses opus opera virus viruses (although see "Use of the virii form" at http://en.wikipedia.org/wiki/Viruses) Bus, of course, is short for omnibus, which in Latin was a plural anyway."Walter Bright" <newshound digitalmars.com> wrote in message news:dt7mur$2hvs$2 digitaldaemon.com...FYI, the -i plural suffix only applies to words that end in 'us', not 'as' or other variants. cactus -> cacti genius -> genii hippopotamus -> hippopotami Apparently, 'bus' is the exception to the rule. "Hey look at all those bi!""Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Could the _t suffix at least be taken off those aliases (alii?) ? int8_t has got to be one of the ugliest things I've seen since CLK_TCK.Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;An interesting read: http://www.csse.monash.edu.au/~damian/papers/extabs/Plurals.html -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O M-- V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e h>--->++ r+++ y+++ ------END GEEK CODE BLOCK------
Feb 22 2006
"James Dunne" <james.jdunne gmail.com> wrote in message news:dtdehf$2pu7$1 digitaldaemon.com...Ah!FYI, the -i plural suffix only applies to words that end in 'us', not 'as' or other variants.Lol, of course that phrase could come up in certain situations ;)Apparently, 'bus' is the exception to the rule. "Hey look at all those bi!"
Feb 20 2006
Walter Bright wrote:"Bruno Medeiros" <daiphoenixNO SPAMlycos.com> wrote in message news:dt705s$1vkh$1 digitaldaemon.com...Hum, interesting, didn't remember about that. Nice, but should also: not have the "_t" idiom; have similar aliases for floating point types (float32, float64, float80, etc.) -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural."Still, it might be nice to have those types in the language, as aliases. It could be a good name alternative, in some situations, to using the new names(like real or cent) for every new size that has come up.import std.stdint;
Feb 18 2006