Wierd | 不常见的C语言写法

今天看到一种比较另类的C语言函数参数声明的写法, 编译居然能通过, 记录一下.

一种 C 语言参数声明写法

1
2
3
4
5
6
7
8
9
#include <stdio.h>

int main(argc, argv)
int argc;
char const *argv[];
{
for (int i=0; i<argc; ++i) printf("%s%c", argv[i], i==argc-1?'\n':' ');
return 0;
}

一种C语言Hello world的精简形式 (虽然会报出很多Warnings)

1
main(){printf("Hello, world!");}

tmp register

A very good way to control temperarily used memory.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#define UNUSED(x) ((void)(x))

#ifdef __cplusplus
#define __I volatile /*!< Defines 'read only' permissions */
#else
#define __I volatile const /*!< Defines 'read only' permissions */
#endif
#define __O volatile /*!< Defines 'write only' permissions */
#define __IO volatile /*!< Defines 'read / write' permissions */

#define __HAL_RCC_USART1_CLK_ENABLE() do { \
__IO uint32_t tmpreg = 0x00U; \
SET_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
/* Delay after an RCC peripheral clock enabling */ \
tmpreg = READ_BIT(RCC->APB2ENR, RCC_APB2ENR_USART1EN);\
UNUSED(tmpreg); \
} while(0)
Python 科学计算 | Numpy 库中 ndarray 与 matrix 类型的区别和使用注意 PAT 真题 | 1038 Recover the Smallest Number

评论

You forgot to set the shortname for Disqus. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×