简体   繁体   中英

What does the macro _bnd(X,bnd) mean?

Recently i read someone implement his own printf use the macro _bnd(x,bnd),but i don't understand what the mean of the macro.

#define _bnd(x, bnd) (sizeof(x) + (bnd) & ~(bnd))

i know the bitwise operator and the sizeof()

It's internal implementation magic, playing with implementation-dependent properties of the addresses of the arguments to variable-argument functions.

Unless you need to know what it all means, likely best to stay away from it. Otherwise it may tempt you to rely on it.

And your macro should be

#define _bnd(X, bnd) (sizeof(X) + (bnd) & ~(bnd))
             ^
             check in your post

Also you can know by just expanding basic arrithmetic operation.For this you should know sizeof() and tilde operator and bitwise operatior .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM