|Re: Attaching data with a timeout signal [message #1758374 is a reply to message #1758352]
||Tue, 28 March 2017 07:53
| Peter Cigehn
Registered: September 2014
Regarding the need for an explicit type cast in this specific case is, as Ernesto tries to explain, that the timeout protocol message can be seen as being defined with a single parameter typed by *, i.e. it can carry any data. Hence the reason why you in this specific case needed to pass along the type descriptor that it actually is an 'int' that is being sent.
So at code-generation time there is no way for the code generator to know which type is going to be sent at run-time. So the only viable solution is to provide a void pointer via rtdata.
This is the same also for user defined protocols, where you define the protocol message parameter to be typed by *, which makes it possible to pass along any type of data, including none at all. Also for those cases, rtdata will be a void pointer.
For any other case, rtdata will be typed according to the type of the (first) parameter of the protocol message. Then there should be no need for an explicit type case, since the type information already exist at code generation time (and hence type safe sends are achieved).
Powered by FUDForum
. Page generated in 0.02112 seconds