ints ints ints and ints

S

Skybuck Flying

Ok,

I am getting really sick of all these integers types. Not only in C... but
mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8

sint16
uin16

sint32
uint32

sint64
uint64

I am getting really really sick of

long long int...

blablabla

short int blablabla

That's BULLSHIT :D

Now at least microsoft has easy stuff:

__int8
__int16
__int32
__int64

etc..

THE SHITTY SHIT IS !!!:

That when I want to compile the same source code on linux/knoppix the
system/compiler starts bitching ofcourse that __int8 is unknown etc !

THAT S WHY I AM GETTING REALLY SICK OF IT :DDDDD

OFCOURSE I COULD JUST DOWNLOAD SOME SOURCE CODE SIGHHHHHHHHHHHHHHH

WITH FRICKING IFDEFS


#IFDEF WINDOWS THEN

__INT8 blablabla

#ENDIF

#IFDEF LINUX THEN

INT BLABLABLA


LOL

THEN I GET SICK OF IFDEFS

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
zzzz

ISN"T IT TIME FOR A FRICKING UPDATE LOL ? :)

By the way.. the same goes for DELPHI, JAVA, AND PROBABLY EVEN THE NEW C#
not to forget crappy good old C++ ? :)

ANYWAY

I have no problems with people wanting a general integer types... Like int
in c or integer in delphi representing the best or most whatever kind of
thing that matches the computer architecture.

That's a good question !

Why is int in C or integer in Pascal...

16 bit for 16 bit systems
32 bit for 32 bit systems
64 bit for 64 bit systems

THAT CAN ONLY LEAD TO PROBLEMS !

The answer is probably SPEED.

I THINK MOST PROGRAMMERS WILL AGREE WITH THIS STATEMENT:

CORRECTNESS VS SPEED

CORRECTNESS PREFAILS !

MAYBE C programmers DISAGREE WITH THAT ?

THAT WOULD BE FUNNY.

ANYWAY since I mentioned DELPHI as WELL.

I RATHER SEE C AND DELPHI/PASCAL PROGRAMS FUNCTION AND COMPILE CORRECTLY ON
WHATEVER THE ARCHITECTURE IS !

THE ONLY WAY TO MAKE SURE IS TO USE INT8, INT16, INT32 etc etc etc.

THEN LATER !!!!! THE CODE CAN BE OPTIMIZED FOR 64 BIT SYSTEMS ?!? RIGHT ?!?!

BESIDES FROM THAT IT WOULD BE BETTER TO HAVE 16 BIT, 32 BIT and 64 BIT
versions of exactly the same source code... but a little bit
different.... at least that's what I do for little routines... :)

CAN SOMEBODY EXPLAIN WHY THE INTEGER TYPES IN C AND DELPHI ARE SO FUCKED IP
?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!

GOD DAMN IT =D

Bye,
Skybuck.
 
M

Mark A. Odell

Ok,

I am getting really sick of all these integers types. Not only in C...
but mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8

sint16
uin16

sint32
uint32

sint64
uint64

I am getting really really sick of

long long int...

They did in C99 (the names are slightly different). Barring a C99
compiler, you should have long ago created a myBaseTypes.h file and placed
these typedefs in it. Then, for eache compiler you work with, just include
myBaseTypes.h and be done with it. You only need to put checks like this
into the header file and then you'll be sure that you get the bit widths
you expect (if they are possible):

/*----------------------------------------------------------------
** TYPE S32
**----------------------------------------------------------------
*/
#define INT_32_MAX (0x7FFFFFFF)
#define INT_32_MIN (0xFFFFFFFF)

#if (SCHAR_MAX == INT_32_MAX)
typedef signed char S32;
#elif (SHRT_MAX == INT_32_MAX)
typedef short int S32;
#elif (INT_MAX == INT_32_MAX)
typedef int S32;
#elif (LONG_MAX == INT_32_MAX)
typedef long S32;
#else
# error "Cannot define type S32."
#endif
 
E

Eric Enright

Skybuck said:
CAN SOMEBODY EXPLAIN WHY THE INTEGER TYPES IN C AND DELPHI ARE SO FUCKED IP
?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!

I think thats enough coffee for you today.
 
S

Skybuck Flying

Mark A. Odell said:
They did in C99 (the names are slightly different). Barring a C99
compiler, you should have long ago created a myBaseTypes.h file and placed
these typedefs in it. Then, for eache compiler you work with, just include
myBaseTypes.h and be done with it. You only need to put checks like this
into the header file and then you'll be sure that you get the bit widths
you expect (if they are possible):

/*----------------------------------------------------------------
** TYPE S32
**----------------------------------------------------------------
*/
#define INT_32_MAX (0x7FFFFFFF)
#define INT_32_MIN (0xFFFFFFFF)

#if (SCHAR_MAX == INT_32_MAX)
typedef signed char S32;
#elif (SHRT_MAX == INT_32_MAX)
typedef short int S32;
#elif (INT_MAX == INT_32_MAX)
typedef int S32;
#elif (LONG_MAX == INT_32_MAX)
typedef long S32;
#else
# error "Cannot define type S32."
#endif


HUH ??????????????????????

I DONT WANT ANY IFDEFS !

I WANT A COMPILER THAT CAN UNDERSTAND

SINT32
UINT32

Or something like that...

So that everybody on the planet can easily write:

sint32 main()
{
sint32 a;
uint8 b;
sint8 c;

a = 12345; // isn't life wonderfull

b = 255; // look at me I just fit !!! :p

c = 128; // oops ? is signed int max 127 or 128 ? hmmm
c = -128; // <-- hmm never seen that so I am pretty sure sint8 is -127
to 128 =DDD yess

return 0;
}

Bye,
Skybuck.
 
K

Keith Thompson

Skybuck Flying said:
Ok,

I am getting really sick of all these integers types. Not only in C... but
mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8 [...]
That's BULLSHIT :D [...]
THAT S WHY I AM GETTING REALLY SICK OF IT :DDDDD
[...]

As it happens, there's a perfectly reasonable answer to your question.
Ask it again, without shouting and swearing at us, and I'll tell you
what it is.

I don't necessarily object to "dirty" words as such, and I can even
sympathize with your frustration, but a little politeness goes a long
way. This isn't alt.flame.
 
J

Jens.Toerring

Skybuck Flying said:
sint8 c;
c = 128; // oops ? is signed int max 127 or 128 ? hmmm
c = -128; // <-- hmm never seen that so I am pretty sure sint8 is -127
to 128 =DDD yess

Live isn't that simple: assuming that sint8 is meant to be a signed
8 bit wide integer type, for a two-complements machine the values it
can store range from -128 to + 127, while on a one-complements
machine only from -127 to +127...
Regards, Jens
 
E

Emmanuel Delahaye

Skybuck Flying said:
I am getting really sick of all these integers types. Not only in C...
but mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8

sint16
uin16

sint32
uint32

sint64
uint64

Get a C99 compiler.

But keep in mind that on some machines (DSP, for example), a byte is wider
that 8 bits! Sorry if you feel sick again..

I use my own typedefs

http://mapage.noos.fr/emdel/clib/ed/inc/TYPES.H

and is fine to me. Just keep in mind the minimum requested values for each
type, and don't go furher, even if the implementation allows it.

For example :
uchar : 0..0xFF
uint/ushort : 0..0xFFFF
ulong : 0..0xFFFFFFFF

simple as that.
 
S

Skybuck Flying

Keith Thompson said:
Skybuck Flying said:
Ok,

I am getting really sick of all these integers types. Not only in C... but
mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8 [...]
That's BULLSHIT :D [...]
THAT S WHY I AM GETTING REALLY SICK OF IT :DDDDD
[...]

As it happens, there's a perfectly reasonable answer to your question.
Ask it again, without shouting and swearing at us, and I'll tell you
what it is.

I don't necessarily object to "dirty" words as such, and I can even
sympathize with your frustration, but a little politeness goes a long
way. This isn't alt.flame.

Ok,

How about this one:

Why god why ? :)
 
S

Skybuck Flying

Live isn't that simple: assuming that sint8 is meant to be a signed
8 bit wide integer type, for a two-complements machine the values it
can store range from -128 to + 127, while on a one-complements
machine only from -127 to +127...

Examples please of one complements and two complements machines with actual
c compilers !

Besides from that it has nothing to do with sint8 vs short int... since both
will have the same problem.

Yet one of them is easier to use !
 
S

Skybuck Flying

Emmanuel Delahaye said:
Get a C99 compiler.

But keep in mind that on some machines (DSP, for example), a byte is wider
that 8 bits! Sorry if you feel sick again..

I use my own typedefs

http://mapage.noos.fr/emdel/clib/ed/inc/TYPES.H

typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

That's what I call sick ! :D

How are you going to call int64 ? or int128 ? or int256 ?
 
S

Skybuck Flying

Live isn't that simple: assuming that sint8 is meant to be a signed
8 bit wide integer type, for a two-complements machine the values it
can store range from -128 to + 127, while on a one-complements
machine only from -127 to +127...

Besides from that... suppose many of these types of machines exist then the
recommendation is really simple:

In the documentation clearly state:

When using sint8 it's wise to limit the range from -127 to 127 so that code
works on one and two complement systems

Voila ! :D

Any problems with that ? :)
 
E

Emmanuel Delahaye

Skybuck Flying said:
typedef unsigned char uchar;
typedef signed char schar;
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;

That's what I call sick ! :D

How are you going to call int64 ? or int128 ? or int256 ?

The C99 standard doesn't define objetcs with a minimum range fitting in more
that 64 bits.

I should probably call them

typedef unsigned long long ullong;

Could be a problem with the next version of the standard.
 
K

Keith Thompson

Skybuck Flying said:
Keith Thompson said:
Skybuck Flying said:
Ok,

I am getting really sick of all these integers types. Not only in C... but
mostly in C.

WHY DOESN'T ANSI MAKE THESE TYPES A STANDARD

sint8
uint8 [...]
That's BULLSHIT :D [...]
THAT S WHY I AM GETTING REALLY SICK OF IT :DDDDD
[...]

As it happens, there's a perfectly reasonable answer to your question.
Ask it again, without shouting and swearing at us, and I'll tell you
what it is.

I don't necessarily object to "dirty" words as such, and I can even
sympathize with your frustration, but a little politeness goes a long
way. This isn't alt.flame.

Ok,

How about this one:

Why god why ? :)

You're not nearly as funny as you think you are.
 
K

Keith Thompson

Emmanuel Delahaye said:

which says:
] typedef unsigned char uchar;
] typedef signed char schar;
] typedef unsigned short ushort;
] typedef unsigned int uint;
] typedef unsigned long ulong;

How are these abbreviations helpful? They don't convey any additional
information to the reader; all they do is save some typing.

If you want an unsigned char, just use "unsigned char".
 
K

Keith Thompson

Emmanuel Delahaye said:
The C99 standard doesn't define objetcs with a minimum range fitting in more
that 64 bits.

The C99 standard requires int8_t, int16_t, int32_t, and int64_t if the
corresponding exact-width types are supported. It allows (and,
arguably, encourages) intN_t for any supported size. If an
implementation provides a 128-bit integer type, I would expect it to
declare int128_t. (Likewise for uintN_t, of course.)
I should probably call them

typedef unsigned long long ullong;

Again, I don't see how that's useful. The type is unsigned long long;
just call it that.
 
E

Emmanuel Delahaye

In 'comp.lang.c' said:
] typedef unsigned char uchar;
] typedef signed char schar;
] typedef unsigned short ushort;
] typedef unsigned int uint;
] typedef unsigned long ulong;

How are these abbreviations helpful? They don't convey any additional
information to the reader; all they do is save some typing.

If you want an unsigned char, just use "unsigned char".

Yes, it's debatable, but type saving is sometimes not an option in a
professional environment.
 
K

Keith Thompson

Emmanuel Delahaye said:
In 'comp.lang.c' said:
] typedef unsigned char uchar;
] typedef signed char schar;
] typedef unsigned short ushort;
] typedef unsigned int uint;
] typedef unsigned long ulong;

How are these abbreviations helpful? They don't convey any additional
information to the reader; all they do is save some typing.

If you want an unsigned char, just use "unsigned char".

Yes, it's debatable, but type saving is sometimes not an option in a
professional environment.

Huh? What does a "professional environment" have to do with it?

There are numerous ways to define abbreviations (in your text editor,
for example) without inflicting them on your readers.
 
H

Harti Brandt

On Fri, 9 Jul 2004, Skybuck Flying wrote:

SF>
SF>SF>> Skybuck Flying wrote:
SF>> >CAN SOMEBODY EXPLAIN WHY THE INTEGER TYPES IN C AND DELPHI ARE SO FUCKED
SF>IP
SF>> >?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!?!
SF>>
SF>> I think thats enough coffee for you today.
SF>
SF>Lol, I am drinking pepsi right now =D

That's even worse...

harti
 
A

Alex Fraser

Keith Thompson said:
Emmanuel Delahaye said:

which says:
] typedef unsigned char uchar;
] typedef signed char schar;
] typedef unsigned short ushort;
] typedef unsigned int uint;
] typedef unsigned long ulong;

How are these abbreviations helpful? They don't convey any additional
information to the reader; all they do is save some typing.

Patently untrue; they also save some reading, which is - arguably - of
benefit for function parameter lists and casts.

Alex
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top