u_int型とかu_char型ってなに?

| コメント(0) | トラックバック(0)
あるC言語で書かれたプログラムのソースを見ててu_intとかu_charとかいう方があって、これってなんだろうと思ったので調べてみた。

Mac OS X(Leopard)だと/usr/include/sys/types.hに答えが。

typedef unsigned char           u_char;
typedef unsigned short          u_short;
typedef unsigned int            u_int;

なるほど。unsigned intやunsigned charのエイリアスなんだね。

ちなみにCentOSとTurboLinuxだと/usr/include/sys/types.hには

typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;

と書いてあって、__u_charとかは/usr/include/bits/types.hに

typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;

って書いてありました。

トラックバック(0)

トラックバックURL: http://blog.clouder.jp/mt/mt-tb.cgi/1043

コメントする

検索

広告

月別 アーカイブ

OpenID対応しています OpenIDについて
Powered by Movable Type 5.12