Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Who likes short shorts?

Reply
Thread Tools

Who likes short shorts?

 
 
Tubular Technician
Guest
Posts: n/a
 
      02-09-2008
Hello, world!

(something I was wondering for a long time)

Since C99 does have 'long long', wouldn't it be more consistent if
there also was a 'short short' type?

That way, plain int could be 64 bits on platforms where that makes
sense, and still two smaller types would be free designating 32 and
16 bit types.

What does everyone think?


 
Reply With Quote
 
 
 
 
user923005
Guest
Posts: n/a
 
      02-09-2008
On Feb 8, 4:43*pm, Tubular Technician <n...@spam.invalid> wrote:
> Hello, world!
>
> (something I was wondering for a long time)
>
> Since C99 does have 'long long', wouldn't it be more consistent if
> there also was a 'short short' type?
>
> That way, plain int could be 64 bits on platforms where that makes
> sense, and still two smaller types would be free designating 32 and
> 16 bit types.
>
> What does everyone think?


http://www.dinkumware.com/manuals/?m...ge=stdint.html
 
Reply With Quote
 
 
 
 
Malcolm McLean
Guest
Posts: n/a
 
      02-09-2008

"Tubular Technician" <> wrote in message
> Hello, world!
>
> (something I was wondering for a long time)
>
> Since C99 does have 'long long', wouldn't it be more consistent if
> there also was a 'short short' type?
>
> That way, plain int could be 64 bits on platforms where that makes
> sense, and still two smaller types would be free designating 32 and
> 16 bit types.
>
> What does everyone think?
>

That's a nice bit of lateral thinking.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

 
Reply With Quote
 
CJ
Guest
Posts: n/a
 
      02-09-2008
On Feb 9, 7:41 am, "Malcolm McLean" <regniz...@btinternet.com> wrote:
> "Tubular Technician" <n...@spam.invalid> wrote in message
> > Hello, world!

>
> > (something I was wondering for a long time)

>
> > Since C99 does have 'long long', wouldn't it be more consistent if
> > there also was a 'short short' type?

>
> > That way, plain int could be 64 bits on platforms where that makes
> > sense, and still two smaller types would be free designating 32 and
> > 16 bit types.

>
> > What does everyone think?

>
> That's a nice bit of lateral thinking.
>
> --
> Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm


If, in bits, a long long is twice the size of a long, a short short
should be half the size of a short. Is that not a char?
 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      02-09-2008
CJ said:

> On Feb 9, 7:41 am, "Malcolm McLean" <regniz...@btinternet.com> wrote:
>> "Tubular Technician" <n...@spam.invalid> wrote in message
>> > Hello, world!

>>
>> > (something I was wondering for a long time)

>>
>> > Since C99 does have 'long long', wouldn't it be more consistent if
>> > there also was a 'short short' type?

>>
>> > That way, plain int could be 64 bits on platforms where that makes
>> > sense, and still two smaller types would be free designating 32 and
>> > 16 bit types.

>>
>> > What does everyone think?

>>
>> That's a nice bit of lateral thinking.
>>
>> --
>> Free games and programming
>> goodies.http://www.personal.leeds.ac.uk/~bgy1mm

>
> If, in bits, a long long is twice the size of a long, a short short
> should be half the size of a short. Is that not a char?


Not necessarily. It is perfectly legal to have, say, a 37-bit char and a
37-bit short.


--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      02-09-2008

"CJ" <> wrote in message news
>
> If, in bits, a long long is twice the size of a long, a short short
> should be half the size of a short. Is that not a char?
>

So we've got rid of that annoying overwork of the 'char' keyword to mean
"small integer". Where int is 64 bits, short 32, short shor 16, we can
introducue a short short short type of 8 bits.
Now I know what you're going to say. Shouldn't we have a short short short
short? The answer is no. That violates the rule of three (see website).
short short short short should be s4, and is, conveniently, 4 bits on a
64-bit system.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm



 
Reply With Quote
 
CJ
Guest
Posts: n/a
 
      02-09-2008
On Feb 9, 10:41 am, "Malcolm McLean" <regniz...@btinternet.com> wrote:
> "CJ" <spamb...@mindspring.com> wrote in message news
>
> > If, in bits, a long long is twice the size of a long, a short short
> > should be half the size of a short. Is that not a char?

>
> So we've got rid of that annoying overwork of the 'char' keyword to mean
> "small integer". Where int is 64 bits, short 32, short shor 16, we can
> introducue a short short short type of 8 bits.
> Now I know what you're going to say. Shouldn't we have a short short short
> short? The answer is no. That violates the rule of three (see website).
> short short short short should be s4, and is, conveniently, 4 bits on a
> 64-bit system.
>
> --
> Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm


LOL, I enjoyed your addition to the "rule of three," however I don't
totally agree with it. I a five dimensional array container that I
conceptualized, implemented and functions quite well. True, most
developers who follow on to my logic have difficulty visualizing
beyond three dimensions, they can learn how it works.

Physics is rapidly approaching complete acceptance of eleven
dimensions since realizing it united the various string theories into
one "magically."

That said, a short short is as redundant as long long. I understand
as our technology advances, increasing variable storage to currently
inconceivable widths, new "language" will always be needed to insure
backwards portability with existing software. But, at some point we
will stop this practice.

Perhaps a long should be the largest integer available on all
hardware, and int should be half the size of a long, a short half the
size of an int, and a char half the size of a short. So long as the
number of bits reflected in each primitive defined is accessible, one
can adapt their use accordingly.

When our technology extends to 128-bit system, we do not simply adopt
"long long long" declaration for a 128-bit integer.

cj
 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      02-09-2008
In article <H8OdneciMrE->,
Malcolm McLean <> wrote:

>So we've got rid of that annoying overwork of the 'char' keyword to mean
>"small integer". Where int is 64 bits, short 32, short shor 16, we can
>introducue a short short short type of 8 bits.
>Now I know what you're going to say. Shouldn't we have a short short short
>short? The answer is no. That violates the rule of three (see website).
>short short short short should be s4, and is, conveniently, 4 bits on a
>64-bit system.


no, short short short short *should* be a single bit. Until we
get to 256 bit systems, for which short short short short short short
would be a bit.
--
"I will speculate that [...] applications [...] could actually see a
performance boost for most users by going dual-core [...] because it
is running the adware and spyware that [...] are otherwise slowing
down the single CPU that user has today" -- Herb Sutter
 
Reply With Quote
 
Army1987
Guest
Posts: n/a
 
      02-09-2008
user923005 wrote:

> On Feb 8, 4:43Â*pm, Tubular Technician <n...@spam.invalid> wrote:
>> Hello, world!
>>
>> (something I was wondering for a long time)
>>
>> Since C99 does have 'long long', wouldn't it be more consistent if
>> there also was a 'short short' type?
>>
>> That way, plain int could be 64 bits on platforms where that makes
>> sense, and still two smaller types would be free designating 32 and
>> 16 bit types.
>>
>> What does everyone think?

>
> http://www.dinkumware.com/manuals/?m...ge=stdint.html


These are ultimately just typedefs for char, signed char, unsigned char,
short, unsigned short, int, unsigned int, long, unsigned long, long long
and unsigned long long. (The implementation might define other types.)
The OP is asking to add to that list. But then, which will the conversion
specifier for *printf? "hhd" is already used for signed char...
More seriously, I think that a short short type would likely have the same
size of short, or char, on most systems. More useful would be a short
float, which would have the same size of a short int but wider dynamic
range: http://en.wikipedia.org/wiki/Half_precision


--
Army1987 (Replace "NOSPAM" with "email")
 
Reply With Quote
 
Tomás Ó hÉilidhe
Guest
Posts: n/a
 
      02-09-2008
Tubular Technician:

> Hello, world!
>
> (something I was wondering for a long time)
>
> Since C99 does have 'long long', wouldn't it be more consistent if
> there also was a 'short short' type?
>
> That way, plain int could be 64 bits on platforms where that makes
> sense, and still two smaller types would be free designating 32 and
> 16 bit types.
>
> What does everyone think?



I'd rather the idea where you specify:

1) The range you want
2) The optimisation you want (e.g. for speed, for less memory consumption)

Something like:

int(min = -235,max = 78933,opt = fast) i;

--
Tomás Ó hÉilidhe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference of extern short *x and extern short x[]? Andre C Programming 5 07-17-2012 07:38 PM
unsigned short, short literals Ioannis Vranos C Programming 5 03-05-2008 01:25 AM
longs, long longs, short short long ints . . . huh?! David Geering C Programming 15 01-11-2007 09:39 PM
unsigned short short? slougheed@gmail.com C++ 4 10-16-2006 11:25 PM
OT: How do you tell if a woman likes you? Blot MCSE 8 07-02-2004 04:15 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57