当前位置:网站首页>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
边栏推荐
- Alicloud disk mounted locally
- Instant aesthetics of the Centennial Olympic Games: beauty in the air, condensed in minutes and seconds - Alibaba cloud video cloud AI editorial department "cloud smart scissors"
- Node connection MySQL
- Desktop network error display red ×, Component failed to start
- Cross project measurement is a good helper for CTOs and PMOS
- Literals and type conversions of basic data types
- [machine learning] machine learning from zero to mastery -- teach you to recognize handwritten digits using KNN
- ThreadLocal class
- Interview shock: talk about thread life cycle and transformation process?
- Docker failed to remotely access 3306 after installing MySQL
猜你喜欢

Getting started and using postman
2022 "gold, silver and four" is a must for job hopping. You must know 100 questions in 2022 intermediate and advanced Android interview to realize your big factory dream

1.1-mq visual client preliminary practice

Installing mysql8 under centos8

05 configuring network parameters

Docker failed to remotely access 3306 after installing MySQL

Finger collar pin exclusive Medal

What is a server? (Powercert animated videos)
MySQL installation tutorial

Compile 6relayd using the cross compiler
随机推荐
Svn various color states
Interview records
This is a simple and cool way to make large screen chart linkage. Smartbi will teach you
lombok
Code program related problems troubleshooting directory
Yolov4 reading notes (with mind map)! YOLOv4: Optimal Speed and Accuracy of Object Detection
Installing mysql8 under centos8
The live registration is hot to start | the first show of Apache dolphin scheduler meetup in 2022!
[summary] 2021unctf Campus (cry & MISC)
MySQL installation tutorial
Illustration tcp/ip - Chapter 3 and 4 notes
Is Galaxy Securities reliable? Is it safe to open a securities account?
Yunzhisheng atlas supercomputing platform: computing acceleration practice based on fluid + alluxio (Part 2)
Is it safe to fry stocks with compass or securities software? Where can I open an account and how
Cvpr2021 collection of papers | cvpr2021 latest papers | cvpr2021 review results | cvpr2021 admission results
01 network basics
How to solve the problem of flash write protection in STM32?
Causes and solutions of unreliable JS timer execution
Multi database and multi table backup and restore of MySQL under Linux
Getting started and using postman