当前位置:网站首页>Thinking about function declaration

Thinking about function declaration

2022-06-10 09:09:00 Andy Pines

Recently <C And a pointer > In Chapter 7, I have some thoughts on function declaration , Sum it up

1. Why function declarations

The function declaration is used to tell the compiler about the function , So that the compiler can check when the function is called

2. The form of function declaration

3. A dangerous way to use function prototypes ( stay gcc Not always correct )

The functions and methods of function declarations are reviewed above , stay <C And a pointer > There are examples in this section that illustrate a dangerous way to use function declarations , May be due to compiler differences and optimization , The results of my own experiment are different

Notice that in the experimental results I posted , Whether the declaration is in the same code block or not , Function prototypes must be compatible with

原网站

版权声明
本文为[Andy Pines]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206100902219184.html