View previous topic :: View next topic |
Author |
Message |
Pse
Joined: 13 Dec 2007 Posts: 36
|
Posted: Thu Dec 20, 2007 10:17 pm Post subject: |
|
|
ShprotX, those are some good points.
1) I agree, it's not really necessary to create a temporary object, compare, and return accordingly. Either by throwing an exception or by returning what gtk returned, if object construction fails, we'll still end up a with a null object.
2) Yes, it'd be bad if the user bypassed gtkd and then passed the object to gtkd without first checking it. I think this provides a good example of when exceptions might provide good information for unhandled cases.
However, I'd like to address your point about unnecessary memory copies. Object construction should not be considered a cheap operation: resources are being assigned, base class constructors getting called, etc. Therefore, a simple pointer copy operation is virtually free. There's no point trying in trying to optimize them out. However, I do agree they're not really needed (not even for code clarity), so it might be in place to avoid them, as you propose. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|