ints ints ints和int [英] ints ints ints and ints

查看:113
本文介绍了ints ints ints和int的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,


我真的厌倦了所有这些整数类型。不仅仅是在C ......而是

主要在C中。


为什么没有ANSI将这些类型作为标准

sint8

uint8

sint16

uin16


sint32

uint32

sint64

uint64


我真的真的生病了


long long int ...


blablabla


short int blablabla


那是'BULLSHIT:D


现在至少微软有简单的东西:


__int8

__int16

__int32

__int64


等..


THE SHITTY SHIT是!!!:


当我想在linux / knoppix上编译相同的源代码时,

系统/编译器开始婊子当然__int8是未知的等等!


这就是为什么我真的很喜欢它:DDDDD


OFCOURSE我只能下载一些来源代码SIGHHHHHHHHHHHH HHH


与FRICKING IFDEFS

#IFDEF WINDOWS那么


__INT8 blablabla


#ENDIF


#IFDEF LINUX那么


INT BLABLABLA

LOL
<登记/>
,则我得到的ifdef


SICK ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzz

ZZZZ


ISN"更新LOL LOL的时间到了吗? :)


顺便说一句.. DELPHI,JAVA也是如此,有可能新的C#

不要忘记糟糕的旧C ++? :)


ANYWAY


我对想要一般整数类型的人没有问题...喜欢int

in c或delphi中的整数表示与计算机体系结构匹配的最好或最无任何类型的



这是一个很好的问题!


为什么在C中为int或在Pascal中为整数...

16位系统的
16位

32用于32位系统的位
64位系统的
64位


只能导致问题!


答案很可能是SPEED。


我认为大多数程序员都会同意这个声明:


正确与速度

正确的预备!


可能C程序员不同意?


这将是有趣的。


因为我提到DELPHI就好了。


我一起看C和DELPHI / PASCAL程序功能和正确编译

无论架构如何!


唯一的方法是确保使用INT8,INT16,INT32等等。


那么晚了!!!!!该代码可以针对64位系统进行优化吗?!?对吗?!?!


从它那里得到16比特,32比特和64比特的BESIDES
完全相同的源代码的
版本。 ..但是一点点

不同......至少那是我为小事做的事情...... :)


可以很多人解释为什么整数类型在C和DELPHI都是那么糟糕的IP

?!?!?!?!?!?!?!?!?!?!?!?!?!?!? !?!?!?!


GOD DAMN IT = D


再见,

Skybuck。








解决方案

" Skybuck Flying" <无**** @ hotmail.com>写在

新闻:cc ********** @ news3.tilbu1.nb.home.nl:

好的,

我真的厌倦了所有这些整数类型。不仅在C ......
而且主要在C中。

为什么没有ANSI使这些类型成为标准

sint8
uint8 < brint>
sint32
uint32

sint64
uint64

我我真的很厌倦

很长的时间......




他们在C99做过(名字略有不同)。除非有一个C99

编译器,你应该很久以前创建了一个myBaseTypes.h文件并在其中放置了这些typedef

。然后,对于你使用的eache编译器,只需要包含

myBaseTypes.h并完成它。你只需要把这样的支票

放到头文件中然后你就可以确定你得到的位宽

你想要的(如果可能的话) :


/ * ----------------------------------- -----------------------------

** 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"无法定义类型S32。

#endif




" Mark A. Odell" < OD ******* @ hotmail.com>在消息中写道

news:Xn ******************************** @ 130.133.1 。 4 ...

" Skybuck Flying" <无**** @ hotmail.com>在
新闻中写道:cc ********** @ news3.tilbu1.nb.home.nl:

好的,
而且主要在C中。

为什么没有ANSI使这些类型成为标准

sint8
uint8 < brint>
sint32
uint32

sint64
uint64

我我真的很厌倦

很长的时间......



他们在C99做过(名字略有不同)。除了C99
编译器之外,您应该很久以前创建了一个myBaseTypes.h文件并在其中放置了这些typedef。然后,对于你使用的eache编译器,只需要包含
myBaseTypes.h并完成它。你只需要把这样的支票放在头文件中,然后你就可以确定你得到了你期望的位宽(如果可能的话):
/ * ----------------------------------------------- -----------------
** 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"无法定义类型S32。"
#endif



HUH ??? ?????????????????? b $ b我不想要任何IFDEFS!


我想要一个可以理解的编译器


SINT32

UINT32


或类似的东西...


这样地球上的每个人都可以轻松写下来:


sint32 main()

{

sint32 a;

uint8 b;

sint8 c;


a = 12345; //不是生活美好


b = 255; //看着我,我很适合! :P


c = 128; //哎呀?签名int max 127或128?嗯

c = -128; //< - hmm从未见过,所以我很确定sint8是-127

到128 = DDD yess


返回0;

}


再见,

Skybuck。


Skybuck Flying写道:< blockquote class =post_quotes>有些人可以解释为什么C和DELPHI中的整数类型是如此糟糕的IP?
?!?!?!?!?!?!?!?!?!?!?!?! ?!?!?!?!?!?!




我认为今天咖啡足够了。


- -

Eric Enright /" \

ericAtiptsoftDcom \ / ASCII Ribbon Campaign

X针对HTML电子邮件

公钥:0xBEDF636F / \


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

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzz
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.











解决方案

"Skybuck Flying" <no****@hotmail.com> wrote in
news:cc**********@news3.tilbu1.nb.home.nl:

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



"Mark A. Odell" <od*******@hotmail.com> wrote in message
news:Xn********************************@130.133.1. 4...

"Skybuck Flying" <no****@hotmail.com> wrote in
news:cc**********@news3.tilbu1.nb.home.nl:

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


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.


Skybuck Flying wrote:

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



I think thats enough coffee for you today.

--
Eric Enright /"\
ericAtiptsoftDcom \ / ASCII Ribbon Campaign
X Against HTML E-Mail
Public Key: 0xBEDF636F / \


这篇关于ints ints ints和int的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆