小代码积累

101 阅读1分钟

#大小写转换

  1. #define tolower(c) ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
  2. #define toupper(c) ((c >= 'a' && c <= 'z') ? (c & ~0x20) : c)

#宏代替名字空间

  1. #define BEGIN_NAMESPACE(X) namespace x {
  2. #define END_NAMESPACE(X) }