Who likes short shorts?

  • Thread starter Tubular Technician
  • Start date
B

Bartc

How about notation similar to c++ templates one specifies the accuracy
in bits for integers, and the precision for reals and let the compile
"pick" the "object" to contain it.

int<1> a truly Boolean variable (_Bool)

I take it that one's unsigned?
int<8> a UTF-7 char, or signed smallint
int<16> a signed short
int<32> a signed int
int<256> a "long long long long" ???
unsigned<64> an unsigned long long
real<6.2> a float
real<12.2> a double

Is this really in C++? Looks more like fixed point than float.
 
B

Bartc

Walter Roberson said:
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 suggest short, shorter and shortest.

Or, short, very short, ultra short (a bit like vhf and uhf).

And perhaps medium for ints which are neither short nor long.

Otherwise it gets a bit silly..
 
R

Randy Howard

How about notation similar to c++ templates one specifies the accuracy
in bits for integers, and the precision for reals and let the compile
"pick" the "object" to contain it.

int<1> a truly Boolean variable (_Bool)
int<8> a UTF-7 char, or signed smallint
int<16> a signed short
int<32> a signed int
int<256> a "long long long long" ???

unsigned<64> an unsigned long long

real<6.2> a float
real<12.2> a double

This allows for future compatibility to CPUs yet to be designed.

I was joking around actually. I guess emoticons really are still
required even in silly cases.

Anyway, more seriously why not just use something like stdint.h
instead?
 
R

Randy Howard

I suggest short, shorter and shortest.

Or, short, very short, ultra short (a bit like vhf and uhf).

And perhaps medium for ints which are neither short nor long.

Otherwise it gets a bit silly..

It's already silly. :)
 
S

Stephen Sprunk

CJ said:
How about notation similar to c++ templates one specifies the accuracy
in bits for integers, and the precision for reals and let the compile
"pick" the "object" to contain it.

int<1> a truly Boolean variable (_Bool)

_Bool (or bool said:
int<8> a UTF-7 char, or signed smallint
int8_t

int<16> a signed short
int16_t

int<32> a signed int
int32_t

int<256> a "long long long long" ???

int256_t, one day...
unsigned<64> an unsigned long long

uint64_t

It appears you haven't heard of said:
real<6.2> a float
real<12.2> a double

Hmmm; perhaps a said:
This allows for future compatibility to CPUs yet to be designed.

No, it guarantees incompatibility with any (present or future) CPU that
isn't designed exactly how you expect (i.e. power-of-two-sized integer
types). C's original set of integer types are specified as "at least" as
large as a certain size for a reason: not all systems are alike, and
assuming even basic things like register size would make the language less
portable. If you want a specific size integer, and don't care about _your_
code being portable, those are now available as well with any decent
implementation.

S
 
A

Army1987

Bartc said:
I suggest short, shorter and shortest.

Or, short, very short, ultra short (a bit like vhf and uhf).

And perhaps medium for ints which are neither short nor long.

Otherwise it gets a bit silly..
What about XXS, XS, S, M, L, XL, XXL for _Bool, char, short, int, long,
long long, __int128? So we can have 3XL for 256 bits integers, and 7XL for
4096-bit integers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top