11.22.2007

不懂為什麼這麼多人要定義 WORD,BYTE,DWORD...
直接用 unsigned short, char, unsigned long 不好嗎?

大家都要用自己的名子 (再加上模組化 做得不好),最後就是..
typedef short SHORT;
typedef long LONG;

typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;

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

typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;

typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;

typedef int INT;
typedef unsigned int UINT;

typedef short Int16;
typedef unsigned short UInt16;
typedef unsigned long UInt32;
typedef unsigned char UInt8;

#define U32 unsigned int
#define U16 unsigned short
#define S32 int
#define S16 short int
#define U8 unsigned char
#define S8 char

typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef signed int int32;
typedef signed short int16;
typedef signed char int8;
他們沒有想過自己的code,有一天,會要和其他人的code一起工作嗎 ?

讓自己寫的code可以讓很多人方便的使用,不是比較好嗎?
還是自己寫得爽比較重要 ?

7 則留言:

勇者昇 提到...

可能想說後面有數字比較好了解幾個bit吧

Checko 提到...

Ho! 會是這樣 ?

匿名 提到...

Checko 貌似還不認識 programmers?

Checko 提到...

啊,被發現了..:p 我其實很宅。

鍾志均 提到...

charle是宅男喔
那要請Auron來車拼一下
Auron可以 Aloha大力推薦的宅男呢
還推薦周杰倫的新歌-陽光宅男給Auron

匿名 提到...

應該是為了避免在不同platform上,int可能是16bits或32bits的狀況。

Checko 提到...

對呀,以前有porting 16 bit 到32 bit時,就深刻感覺到這個問題。

但是,size matter 的code,可以用short, long, long long..