Found here: https://github.com/tpaviot/oce/blob/master/src/BRepAdaptor/BRepAdaptor_Curve.cxx
The line I'm wondering about is:
((GeomAdaptor_Curve*) (void*) &myCurve)->Load(C,First,Last);
myCurve
is already defined as a GeomAdaptor_Curve
. So it looks like it's casting a pointer to myCurve
as a void*
, and then casting that as a GeomAdaptor_Curve*
, and then dereferencing it and calling Load
on it. What possible reason could there be for doing that, rather than simply calling myCurve.Load
?
Type Casting is basically a process in C in which we change a variable belonging to one data type to another one. In type casting, the compiler automatically changes one data type to another one depending on what we want the program to do.
Codecasting is the process of recording your coding session, and casting it out to any number of participants, generally in real-time. JS Bin supports codecasting out of the box, for free, to both registered and anonymous users.
Implicit type conversion in C happens automatically when a value is copied to its compatible data type. During conversion, strict rules for type conversion are applied. If the operands are of two different data types, then an operand having lower data type is automatically converted into a higher data type.
Type casting is when you assign a value of one data type to another type.
Note that statement appears in a const
member function. So the type of &myCurve
is actually GeomAdaptor_Curve const*
. This appears to be an ugly and confusing way to say
const_cast<GeomAdaptor_Curve&>(myCurve).Load(C,First,Last);
and may have been made more complicated in order to "avoid" compiler warnings you would get from attempting to use a C-style cast to circumvent const
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With