Let us assume that msg->dup()
returned void *
— that is, a pointer to void
, which means a pointer whose type the compiler doesn’t track. But you may know, e.g. because of documentation on that function, or because certain preconditions have been met, that msg->dup()
will return a pointer to CMessage
. Before you can use the return value as such, you need to tell the compiler what the type actually is. You do that by casting the void *
to CMessage *
, which uses the syntax you see.
0
solved confusing notation in C++ (OMNeT++)