2010-05-24 29 views
34

當編寫C++代碼是沒有任何區別:在std::命名空間內所包含大多cstdlib和stdlib.h有什麼區別?

#include <cstdlib> 

#include <stdlib.h> 
比前者其他

除了編碼標準和風格之外,還有什麼其他的原因可以使用嗎?

+0

[C++中stdlib.h和cstdlib之間的主要區別是什麼?](https://stackoverflow.com/questions/2847729/whats-the-main-difference-between-stdlib-h-and- cstdlib-在-c)的 – 2017-09-02 15:55:25

回答

35

第一個是C++頭,第二個是C頭。由於第一次使用命名空間,這似乎是更可取的。

11

不,除了命名空間的情況,它們本質上是相同的。