![]() ![]() In fact, a simple test compiled in release mode gives me the same assembly output in both cases. I would think that for some double x, static_cast(x) is exactly equivalent to x != 0.0. Inline bool GetScalar(FBProperty& prop, FBEvaluateInfo* evaluateInfo) I can add a specialization of GetScalar to handle the bool case: template #pragma warning (disable: 4800) // Don't complain about casting to bool I can suppress the warning directly with pragmas, since the cast is doing exactly what I wanted it to do: template ![]() Citerne primagaz location, Mieszanka rapu, Postgres type cast integer. In order to address this warning, I have two options. w Bouse de vache dessin, Chowdhury and hossain english book, Da yeon shin. Since my original aim was to handle multiple types (bool, float, double, etc) with a single template function, I can't just add in the usual != 0.0. ![]() When the compiler creates GetScalar, it winds up with a static_cast from double to bool, which it apparently doesn't like. When I use GetScalar, the compiler produces a C4800 warning: 'double' : forcing value to bool 'true' or 'false' (performance warning) ![]() I'm compiling in Visual Studio with /W4 and addressing all warnings as they come up. This way, I can write GetScalar(camera.Roll, evaluateInfo) or GetScalar(camera.Visibility, evaluateInfo) instead of having a multiple-line mess of uninitialized buffers and casts littering my code. Prop.GetData(&data, sizeof(data), evaluateInfo) Inline DataT GetScalar(FBProperty& prop, FBEvaluateInfo* evaluateInfo) Here's a utility function I wrote to evaluate the value of a scalar property: template In order to access a MotionBuilder property's value, you read it into a double variable, regardless of what sort of data type it actually represents. I'm working with the API for an application called MotionBuilder. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |