1 /**************************************************************************2 * C templet and switch case with serial number3 * Disclaimer:4 * 1, this article refers to the "Android low-level development technology practical details-kernel, porting and driving." 5 * 2, in which the general part of the book is wrong, you need to add a backslash at the end of the line. 6 *7 * 2015-7-19 Sunny Shenzhen Nanshan Ping Shan village Zengjianfeng Sunday8 *************************************************************************/9#include <stdio.h>Ten One /** A * implemented a generic form in C + +, which is the template - */ - #defineMin (x, y) ({ the typeof(x) _min1 =(x); - typeof(y) _min2 =(y); -_min1 < _min2?_min1: _min2;}) - + intMainintargcChar**argv) { -printf"min (1, 2) =%d", Min (1,2 ) ); + A intMajor_idx =3; at Switch(MAJOR_IDX) { - Case 0: -printf"0.\n"); - Break; - Case 1...4://Be sure to remember ... There are spaces on both sides -printf"0...4.\n"); in Break; - default: toprintf"default.\n"); + Break; - } the}
C templet and switch case with serial number