intrinsic,primitive types

Discussion in 'C' started by samuelwhalley, May 5, 2008.

  1. samuelwhalley

    samuelwhalley New Member

    Joined:
    Apr 24, 2008
    Messages:
    7
    Likes Received:
    1
    Trophy Points:
    0
    When initializing non-static data members of built-in / intrinsic / primitive types, should I use the "initialization list" or assignment.....????
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    These days it does not make much of a difference because PC are more than what the benefit it gives for initialization list and assignments.

    At least from practicality point of view I prefer assignments because it makes code cleaner and I don't have to think more when I edit the class with new data members.
     
  3. asadullah.ansari

    asadullah.ansari TechCake

    Joined:
    Jan 9, 2008
    Messages:
    356
    Likes Received:
    14
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    NOIDA
    Why you are thinking about only PC. It may be for some other like MPC,i960 etc i.e for embedded OffCourse for inbuilt data type you will not get any benefit of using initialization list. In this case you can use assignment operator. But for user define data types, you should use Initialization list.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I agree but as the thread is in C-C++ forum its expected not to be in that language but yes its not impossible.
     
  5. asadullah.ansari

    asadullah.ansari TechCake

    Joined:
    Jan 9, 2008
    Messages:
    356
    Likes Received:
    14
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    NOIDA
    You are absolutely right for a C++ application running on Pc.
    But I am talking in same langauges C++ only but i mean processorlike MPC,i960 etc for embedded software. It's not like core dual, p4 etc.
    You are absolutely right
     
    Last edited: May 6, 2008

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice