[Temporary storage] variable configuration, storing Variables

Source: Internet
Author: User

[Temporary storage] variable configuration, storing Variables

1 # include "stdio. h "2 3 struct var_tab_item 4 {5 const char * name; 6 const char * desc; 7 char type; 8 void * var; 9}; 10 # define SECTION (name) _ attribute _ (section (name) 11 # define EXPORT_VAR (name, desc, type) \ 12 const char _ var _ # name # _ name [] = # name; \ 13 const char _ var _ # name # _ desc [] = # desc; \ 14 const struct var_tab_item _ var _ # name SECTION ("ExVar ") = \ 15 {\ 16 _ var _ ## name ##_ name, \ 17 _ var _ ## name ##_ desc, \ 18 type, \ 19 (void *) & name \ 20}; 21 # define DEFINE_INT32 (name, desc) \ 22 long name = 0 xabcd; \ 23 EXPORT_VAR (name, desc, 'I') 24 25 DEFINE_INT32 (test0, a test setting) 26 DEFINE_INT32 (test1, cool tpdt) 27 28 int main () 29 {30 printf ("% lld \ n ", test0); 31 return 0; 32}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.