C++ test

Oct. 16th, 2009 01:59 pm
[personal profile] scallan
In this test I did, there was a question
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's performance is unpredictable/non-deterministic.
B. RTTI is too slow.
C. RTTI uses too much memory.
D. RTTI does not have standardized run-time behavior.
E. RTTI frequently fails to function correctly at run-time.

To me, none of these seem valid answers. Does anyone else agree with me?

Date: 2009-10-16 01:44 pm (UTC)
From: [identity profile] bellinghman.livejournal.com
A - rubbish.
B - if not a polymorphic type, it gets evaluated at compile time! (3.2/3) Otherwise, it should be as fast as a very fast thing indeed.
C - we're talking of a small per-class item. So not that either, unless there's a template factory gone totally loopy somewhere.
E - appears to be a restatement of A

I'd have to go for D. What you get back from C++ rtti is consistent within the application (and therefore A is incorrect), but not between the same code compiled with different compilers. (Look at type_info - there's the phrase 'implementation defined' spattered around liberally.)

So, if you were serialising messages using the class name as accessed through typeid(), different platforms might well produce different names, and it would break the message channels. However, that only applies to that particular usage of rtti: if the apps aren't passing the rtti information between them, I can't see a problem.

So, D, in certain very limited circumstances.

Date: 2009-10-16 02:35 pm (UTC)
From: [identity profile] nallac.livejournal.com
Pretty much my thoughts.
To me, 'E' is someone saying that it's been badly implemented / standardized, and that it may actually give you incorrect results, in which case you dump the compiler and get one that works.
'D' is the least incorrect, but there's really not enough information in the question to determine that it applies.
As a result, I skipped the question.
Still, I managed to get 97% right (out of 44 questions), and was in the 96th percentile, which really impressed the agent. Enough to hopefully get me through to the next stage.


Simon Callan

September 2014

7 8910111213

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Oct. 21st, 2017 10:53 pm
Powered by Dreamwidth Studios