Prefer C++-style casts.

This is based on Item 2 of "More Effective C++". In general, the C++ cast operators are more expressive and easy to find,
e.g. by grep. Using const_cast also shuts up some compiler warnings.
This commit is contained in:
kai
2012-08-03 06:32:23 +02:00
parent 2dbee75523
commit 311297b096
8 changed files with 18 additions and 18 deletions

View File

@@ -22,7 +22,7 @@ extern bool var_offset_sort_cb(const VarDeclaration* v1, const VarDeclaration* v
IrTypeClass::IrTypeClass(ClassDeclaration* cd)
: IrTypeAggr(cd),
cd(cd),
tc((TypeClass*)cd->type)
tc(static_cast<TypeClass*>(cd->type))
{
std::string vtbl_name(cd->toPrettyChars());
vtbl_name.append(".__vtbl");
@@ -161,7 +161,7 @@ void IrTypeClass::addBaseClassData(
offset = vd->offset + vd->type->size();
// create ir field
vd->aggrIndex = (unsigned)field_index;
vd->aggrIndex = static_cast<unsigned>(field_index);
++field_index;
}