Recommanded Free YOUTUBE Lecture: <% selectedImage[1] %>

사용되는 곳

  • send() sendto() sendmsg() recvmsg() read() write() 등의 데이터 입출력 함수에서 읽고 쓴 데이터의 크기 리턴값

확인

<</usr/include/sys/types.h>>
#ifndef __ssize_t_defined
typedef __ssize_t ssize_t;
# define __ssize_t_defined

<</usr/include/bits/types.h>>
__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error.  */

<</usr/include/bits/typesize.h>>
#define __SSIZE_T_TYPE          __SWORD_TYPE

<</usr/include/bits/types.h>>
#if __WORDSIZE == 32
...
# define __SWORD_TYPE           int
#elif __WORDSIZE == 64
# define __SWORD_TYPE           long int
WORD 사이즈에 따라서 int 혹은 long int 의 typedef 형임을 알 수 있다.

#include <stdio.h>

int main(int argc, char **argv)
{
	printf("WORD SIZE %d\n", __WORDSIZE);
}
내 pc 에서 실행시킨 결과 32 가 출력되었다. 실행시킨 pc의 사양이다.
# cat /proc/cpuinfo
processor       : 0                             
vendor_id       : GenuineIntel                  
cpu family      : 6                             
model           : 15                            
model name      : Intel(R) Core(TM)2 CPU          6600  @ 2.40GHz
stepping        : 6
cpu MHz         : 1596.000
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse 
sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips        : 4795.31
clflush size    : 64
power management:

# uname -a
Linux yundream-desktop 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux