www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - type declaration

reply %u <kelong_2000 yahoo.com> writes:
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
Jan 01 2007
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
%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
Jan 01 2007
prev sibling next sibling parent reply Derek Parnell <derek psych.ward> writes:
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
Jan 01 2007
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
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...
Jan 01 2007
next sibling parent Ary Manzana <ary esperanto.org.ar> writes:
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;
Jan 01 2007
prev sibling parent Derek Parnell <derek nomail.afraid.org> writes:
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
Jan 01 2007
prev sibling parent reply %1.1u <u digitaldaemon.com> writes:
== Quote from %u (kelong_2000 yahoo.com)'s article

Please start by using some human readable names for yourself.
Jan 01 2007
parent Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
%1.1u wrote:
 == Quote from %u (kelong_2000 yahoo.com)'s article
 
 Please start by using some human readable names for yourself.

*ahem*
Jan 01 2007