Can we get C/C++ struct's member number, type, name, and format string?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can we get C/C++ struct's member number, type, name, and format string?

Here is one example.
struct c_test_struct_type {
int i_var;
unsigned int ui_var;
long l_var;
unsigned long ul_var;
}
Is there one an operator provided by GCC to determine the member
nubmer of this struct? For example, I hope to get 4 by calling
'__struct_member_number__(struct c_test_struct_type)' .
Is there one an operator provided by GCC to get the member name of
this struct? For example, I hope to get string 'i_var' by calling
'__struct_member_name__(struct c_test_struct_type, 0)'.
Is there one an operator provided by GCC to get the member type of
this struct? For example, I hope to get string 'int' by calling
'__struct_member_type__(struct c_test_struct_type, 0)'.
Is there one an operator provided by GCC to get the formatted string
of this struct? For example, I hope to get string "i_var: %d, ui_var:
%u, l_var: %ld, llvar: %lld" by calling
'__struct_member_print_format__(struct c_test_struct_type, 0)'.

We can simplify the development if we have such operator. I cannot
find them in GCC documents.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux