In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how the C language # define splicing macro definition is implemented, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Usage: splice two macros, one is the incoming macro. However, the incoming macro will not be replaced, but will be connected intact, which is embarrassing. After various attempts, it turned out to be successful. I would like to record and share it for you to learn.
Char define PARAM DEFINE paramedics 0 void fun Bond prammages 0 DEFINE_ / add macro definition # define OBJECT A # OBJECT (X) X##_param / / define once # define PARAM DEFINE (X) DEFINE_ (X) / / define again # define PARAM DEFINE (OBJECT) void fun () {/ / DEFINE_ (OBJECT) = 100; this operation is rejected, it is directly spliced and not replaced by DEFINE (OBJECT) = 100 / / this operation is amazing, first replace and then splice, we only do the second definition, solve all the troubles PARAM=100;// this is also possible}
Will it achieve your goal in the end? the essential principle is probably the sequence of replacement and splicing. I have not studied it in detail.
The following is one of my uses.
# define STEP_TIMx 4//TIM4#define STEP_CHx 2//CH2#define SET_STEP42_PPS_1 (NUM,X) TIM##NUM- > PSC= ((X)) # define SET_STEP42_PPS_2 (NUM,X) SET_STEP42_PPS_1 (NUM,X) # define SET_STEP42_PPS (X) SET_STEP42_PPS_2 (STEP_TIMx,X) / / the ultimate goal is to achieve TIM4- > PSC=X. I achieved my goal.
On the C language # define splicing macro definition is how to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.