Thread: RTTI for distribution

  1. #1
    Spam is Good
    Join Date
    Jan 2009
    Location
    In a cave on Mars
    Posts
    37

    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).

    Thx.
    "What comes around, goes around"

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    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.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    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.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You seem to be asking a lot of quiz questions (select x from the following 5 options).

    http://cboard.cprogramming.com/showthread.php?t=111049
    http://cboard.cprogramming.com/showthread.php?t=111005
    http://cboard.cprogramming.com/showthread.php?t=111023
    http://cboard.cprogramming.com/showthread.php?t=111024
    http://cboard.cprogramming.com/showthread.php?t=111025
    http://cboard.cprogramming.com/showthread.php?t=111017
    http://cboard.cprogramming.com/showthread.php?t=110935
    3 consecutive posts doesn't look good (it looks like a homework dump).

    Showing that you know the answers is one thing.
    Showing that you can use the information in a practical setting is another.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Sep 2010
    Posts
    1

    Re: Rtti

    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

  6. #6
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Thanks for letting us know, binaryman. Wonder if he got the job?

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Eliminating dynamic_cast<>
    By skewray in forum C++ Programming
    Replies: 22
    Last Post: 09-14-2007, 04:58 PM
  2. Problem with RTTI and a factory method
    By philvaira in forum C++ Programming
    Replies: 4
    Last Post: 07-28-2007, 03:19 PM
  3. RTTI - typeid()
    By vb.bajpai in forum C++ Programming
    Replies: 2
    Last Post: 06-23-2007, 09:12 PM
  4. RTTI - Printing template arg that could be array
    By LuckY in forum C++ Programming
    Replies: 9
    Last Post: 02-18-2005, 04:59 PM
  5. Using rtti (help!!!!!!!)
    By incognito in forum C++ Programming
    Replies: 3
    Last Post: 02-16-2002, 02:12 PM