当前位置:网站首页>Write a "standard" macro min, which inputs two parameters and returns the smaller one
Write a "standard" macro min, which inputs two parameters and returns the smaller one
2022-06-25 21:14:00 【Rabbit cloud program】
Interview questions : Write a ” standard " macro MIN , This macro takes two arguments and returns the smaller one
answer :

This test is designed for the following purposes :
1) identification #define Basic knowledge of macro application , This is a very important basic knowledge . Because in embedded (inline) Operator becomes standard C Part of the previous , Macros are the only way to easily generate embedded code , For embedded systems , In order to achieve the required performance , Embedding code is often a must .
2) Knowledge of triple conditional operators . This operator exists C The reason in the language is that it enables the compiler to produce a ratio of if-then-else Better code , It's important to understand this usage .
3) Know how to use parentheses to enclose parameters carefully in macros
4) I also use this question to start discussing the side effects of macros , for example : What happens when you write the following code ?
least = MIN(*p++, b);
Pay attention to the point : Be sure to add brackets . Many people often forget to include parentheses in macro definitions , Macros are replacement snippets of code ,define Pay attention to edge effects when defining expressions , For example, the following definitions :

The reason lies in the pretreatment stage , Compiler will a = N/2 Deal with it as a = 2+3/2
边栏推荐
- Interviewer: why does TCP shake hands three times and break up four times? Most people can't answer!
- JS__ Prototype, prototype chain, call/apply__ Duyi
- Online yaml to XML tool
- What is DNS (domain name server)? (Powercert animated videos)
- Yunzhisheng atlas supercomputing platform: computing acceleration practice based on fluid + alluxio (Part 2)
- Svn various color states
- IPtables
- [nail scenario capability package] hospital visitor verification
- Yunzhisheng atlas supercomputing platform: computing acceleration practice based on fluid + alluxio (Part I)
- Cvpr2021 collection of papers | cvpr2021 latest papers | cvpr2021 review results | cvpr2021 admission results
猜你喜欢
This is a simple and cool way to make large screen chart linkage. Smartbi will teach you
Chrome plugin installation

Soft test intermediate simple notes
[distributed system design profile (1)] raft

Openocd adds third-party device support: ht32f52352 Cortex-M0+

109 practical shell scripts
HMS core actively explores the function based on hardware ear return, helping to reduce the overall singing delay rate of the singing bar by 60%
Causes and solutions of unreliable JS timer execution

Molecular dynamics - basic characteristics of molecular force field

Rounding related calculation
随机推荐
laf. JS - open source cloud development framework (readme.md)
Get parameters in URL
Working principle and experimental analysis of DHCP
Is it legal to open an account for flush stock trading software? Is it safe?
Is it safe for qiniu school to open an account in 2022?
Kubernetes related knowledge - surprise interview
Day 28/100 CI CD basic introductory concepts
银河证券靠谱吗?开证券账户安全吗?
couldn‘t be accessed by user ‘_ apt‘
同花顺炒股软件开户是合法的吗?安全吗
What is a subnet mask? (Powercert animated videos)
[buucry] sensor (Manchester code)
A simple file searcher
Jingxi Pinpin wechat applet -signstr parameter encryption
Why doesn't anyone read your hard-working blog? Do you really understand the skills of framing, typesetting and drawing?
Installing mysql8 under centos8
Great changes in the interaction between people and the digital world
[nailing scenario capability package] company / Park Digital canteen
Is it safe for Xiaobai to open a stock account online?
Lesson 4 beautifulsoup