Thread: Pointers- Difference From Sending a Copy of the Object?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by grumpy View Post
    Not calling a function if you "didn't have such an object" would eliminate any such need.
    but I'm sure you realize that there are situations where you want to call the function whether you have the object or not, and handle a null in a special way.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Elkvis View Post
    but I'm sure you realize that there are situations where you want to call the function whether you have the object or not, and handle a null in a special way.
    Sure but that is a design choice. Either way, a decision has to be made as to whether an object is valid. The only difference is whether caller or callee makes that determination. Sometimes it makes sense for the caller to do it (eg if a function is called many times and supplied with the same object) and sometimes for the callee to do it.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copy object
    By C_ntua in forum C++ Programming
    Replies: 3
    Last Post: 05-11-2010, 01:16 AM
  2. copy of object?
    By rogster001 in forum C++ Programming
    Replies: 3
    Last Post: 09-29-2009, 04:23 AM
  3. Sending Struct pointers through pipes 2
    By kiros88 in forum C Programming
    Replies: 1
    Last Post: 09-02-2009, 05:52 PM
  4. Creating an object in a dll & sending it to an exe file
    By SteveRodrigue in forum C++ Programming
    Replies: 6
    Last Post: 12-14-2006, 02:01 PM