Feb 26, 2012

[C++ / C Programming] Tips

1. How to get the maximum of an unsigned value.
Use cast.
static_cast<size_type>(-1);
size_type could be a unsigned type.
that's it!

2.Writing C/C++ Macros: Rules, Tricks and Hints

Linux Kernel巨集do{...}while(0)的撰寫

《Linux kernel coding style》 => Documentation/CodingStyle

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.