L
leo.hou
Hi experts,
I am new to linux and all the type definitions are driving me mad. What
is the best way to check a type definition in linux? When I use man
page to check some function definition, I may come across new types.
How do you guys look up their definitions?
I tried to lookup ssize_t, what I do is trace (grep in glibc source
code) to 'typedef __ssize_t ssize_t;', then '__STD_TYPE __SSIZE_T_TYPE
__ssize_t;' then '#define __SSIZE_T_TYPE __SWORD_TYPE' and finally '#
define __SWORD_TYPE int'. So 'int' it is, but that took me about 10
minutes... What is a better way to do so? (any man page, web search,
magic glibc function or bash command that can give me the definition
right away?)
=====
Another question popped up when I was trying to do something like:
#define SIZE_OF_T(T) printf("size = %d\n", sizeof(T))
to make my life a bit easier. How can I use 'T' in the "size ="
formating string? I want to get something like
size of ssize_t = 4
as output. Can anyone help?
Thanks in advance
Best Regards
Leo
I am new to linux and all the type definitions are driving me mad. What
is the best way to check a type definition in linux? When I use man
page to check some function definition, I may come across new types.
How do you guys look up their definitions?
I tried to lookup ssize_t, what I do is trace (grep in glibc source
code) to 'typedef __ssize_t ssize_t;', then '__STD_TYPE __SSIZE_T_TYPE
__ssize_t;' then '#define __SSIZE_T_TYPE __SWORD_TYPE' and finally '#
define __SWORD_TYPE int'. So 'int' it is, but that took me about 10
minutes... What is a better way to do so? (any man page, web search,
magic glibc function or bash command that can give me the definition
right away?)
=====
Another question popped up when I was trying to do something like:
#define SIZE_OF_T(T) printf("size = %d\n", sizeof(T))
to make my life a bit easier. How can I use 'T' in the "size ="
formating string? I want to get something like
size of ssize_t = 4
as output. Can anyone help?
Thanks in advance
Best Regards
Leo