可能重複:
When should static_cast, dynamic_cast and reinterpret_cast be used?「警告:使用舊樣式轉換的」 以g ++
有了這個C++代碼,
char* a = (char*) b;
我警告warning: use of old-style cast
。
什麼是新風格演員?
可能重複:
When should static_cast, dynamic_cast and reinterpret_cast be used?「警告:使用舊樣式轉換的」 以g ++
有了這個C++代碼,
char* a = (char*) b;
我警告warning: use of old-style cast
。
什麼是新風格演員?
reinterpret_cast
static_cast
,dynamic_cast
和const_cast
是C++鑄造替代品。
const_cast
從const變量中刪除const/volatile。dynamic_cast
到多態類型static_cast
之間澆鑄時,在繼承層次進行如向上/向下轉換執行運行時有效性檢查,但沒有運行時檢查,或明確地進行轉換,這種轉換可以是隱式(如浮動到int)reinterpret_cast
在不相關的類型之間進行轉換。閱讀本主題以瞭解C++風格的轉換這有各種口味的:
When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?
那麼,什麼是'B'? – GManNickG 2011-03-09 17:06:54
@GMan:這是拉丁字母后面的'a',並且在'c'之前。 – 2011-03-09 17:12:25
@James:ಠ_ಠ – GManNickG 2011-03-09 17:14:19