RTTI for distribution
Which of the following statements provide a valid reason not to use RTTI for distributed (i.e. networked between different platforms) applications in C++?
A. RTTI is too slow.
B. RTTI uses too much memory.
C. RTTI does not have standardized run-time behavior.
D. RTTI's performance is unpredictable/non-deterministic.
E. RTTI frequently fails to function correctly at run-time.
Ok, in terms of not using RTTI for distribution, I'm completely unsure. Maybe D (but that is just a guess). I don't think it would be E, because to my knowledge the point of RTTI is to improve function at run-time. I'm rather sure A, B are correct for RTTI, but not a good reason why not to use RTTI for distribution. Could someone point me to some good links on this, and/or comment on my thoughts. As I can't find much about the reasons not to use RTTI (for distribution, in particular).
I'd say the best answer is that it's too slow, but I've also seen some RTTI functions work unpredictably also. The only one I trust is dynamic_cast.
There is absolutely no reason not to use RTTI in distributed programs.
However, there is a reason not to use RTTI information in distribution itself: the format of the information (the only information you can get anyway is type_info::name()) is not standardized, so you cannot rely on it across compilers. In other words, you can't take type_info::name() on one node, send the result to another, and expect it to match type_info::name() of any type on that node.
But then, RTTI doesn't provide a means of dynamic instantiation anyway.
This question is exact word-for-word that I had recently at an on-line test I took while applying for a job
Too bad I didn't use google while taking the test
I believe that C is the correct answer
Thanks for letting us know, binaryman. Wonder if he got the job?
Yeah, shame you didn't read this before wading in with the "me too" post far too late to be of any use to anyone.
C Board - Announcements in Forum : C++ Programming