Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
January 01, 2007 type declaration | ||||
---|---|---|---|---|
| ||||
Why use type declarations like this (below) and instead use human readable language to declare what it really is... The use of "double", "short" and "long" is CUMBERSOME! Especially when switching between Processors Architectures. This is trying to be a new language... make it NEW! Or at least make these key words SYNONYMOUS! D Meaning New Key Word byte signed 8 bits int8 short signed 16 bits int16 int signed 32 bits int32 long signed 64 bits int64 cent signed 128 bits int128 float 32 bit floating float32 double 64 bit floating float64 |
January 01, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | %u schrieb am 2007-01-01:
> Why use type declarations like this (below) and instead use human readable language to declare what it really is...
>
> The use of "double", "short" and "long" is CUMBERSOME! Especially when switching between Processors Architectures.
>
> This is trying to be a new language... make it NEW!
> Or at least make these key words SYNONYMOUS!
>
> D Meaning New Key Word
> byte signed 8 bits int8
> short signed 16 bits int16
> int signed 32 bits int32
> long signed 64 bits int64
> cent signed 128 bits int128
> float 32 bit floating float32
> double 64 bit floating float64
Please have a look at the std.stdint module.
Thomas
|
January 01, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | On Mon, 1 Jan 2007 21:27:16 +0000 (UTC), %u wrote: > Why use type declarations like this (below) and instead use human readable language to declare what it really is... I believe there have been some studies done that indicate the use of words containing a mixture of alphabetic and numeric characters is harder to read. It appears that there is a type of 'context switch' silently going on when people see digits in their text. > The use of "double", "short" and "long" is CUMBERSOME! Especially when switching between Processors Architectures. You do realize that D has defined these data types as fixed length. An 'int' is always going to be 32-bits regardless of the CPU architecture. > This is trying to be a new language... make it NEW! > Or at least make these key words SYNONYMOUS! > > D Meaning New Key Word > byte signed 8 bits int8 > short signed 16 bits int16 > int signed 32 bits int32 > long signed 64 bits int64 > cent signed 128 bits int128 > float 32 bit floating float32 > double 64 bit floating float64 Feel free to add these to your own code first, to try it out. alias int8 byte; alias int16 short; alias int32 int; alias int64 long; alias in128 cent; alias float32 float; alias float64 double; And of course, to be consistent, you ought to come up with new terms for the other 'misnamed' datatypes. alias ??? real; alias ??? ifloat; alias ??? idouble; alias ??? ireal; alias ??? cfloat; alias ??? cdouble; alias ??? creal; alias ??? char alias ??? wchar alias ??? dchar -- Derek Parnell |
January 01, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to %u | == Quote from %u (kelong_2000@yahoo.com)'s article
>
Please start by using some human readable names for yourself.
|
January 01, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to %1.1u | %1.1u wrote:
> == Quote from %u (kelong_2000@yahoo.com)'s article
>
> Please start by using some human readable names for yourself.
*ahem*
|
January 01, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Derek Parnell wrote:
> Feel free to add these to your own code first, to try it out.
>
> alias int8 byte;
> alias int16 short;
> alias int32 int;
> alias int64 long;
> alias in128 cent;
> alias float32 float;
> alias float64 double;
I presume you meant those to be reversed...
|
January 02, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel escribió:
> Derek Parnell wrote:
>> Feel free to add these to your own code first, to try it out.
>>
>> alias int8 byte;
>> alias int16 short;
>> alias int32 int;
>> alias int64 long;
>> alias in128 cent;
>> alias float32 float;
>> alias float64 double;
>
> I presume you meant those to be reversed...
He :-)
I too sometimes forget which one is the alias and which one is the aliased. I'd prefer the keyword "alias" to be "aliasof" or something like that:
aliasof int8 byte;
|
January 02, 2007 Re: type declaration | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | On Mon, 01 Jan 2007 23:47:11 +0100, Frits van Bommel wrote: > Derek Parnell wrote: >> Feel free to add these to your own code first, to try it out. >> >> alias int8 byte; >> alias int16 short; >> alias int32 int; >> alias int64 long; >> alias in128 cent; >> alias float32 float; >> alias float64 double; > > I presume you meant those to be reversed... LOL... You presume well... I was hurrying off to work when scribbling that missive. -- Derek (skype: derek.j.parnell) Melbourne, Australia "Down with mediocrity!" 2/01/2007 12:16:08 PM |
Copyright © 1999-2021 by the D Language Foundation