Explicit casts in generated code to avoid compiler warnings.