[关闭]
@nrailgun 2015-10-19T17:10:35.000000Z 字数 390 阅读 1456

C / C++ Traps

程序设计


C: pointer cast

gcc doesn't warn pointer cast by default. Sometimes you want to cast a const void * to const char *, but unfortunately you wrote char *. gcc won't warn you!

C: no return

C return random shit if you forget your return statement. A wild pointer make you think, "Oh, it points to somewhere safe to visit." Well, actually it doesn't. I found I lost some many return statements in NROS kernel! WTF.

C: implicit declaration

C++: redefine variable i

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注