![]() |
possible Improvement |
Post Reply ![]() |
Author | |
redRyder ![]() Newbie ![]() ![]() Joined: 07 January 2004 Location: Pakistan Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() Posted: 20 January 2004 at 5:11am |
I dont know if anyone has noted that, but I find that in almost all the source code parameter passing can be improved a little bit, and the same goes for return types. For example, I find that almost all paramters of type CString or CRect are passed by value. Wouldn't it be nice to pass params as const references whereever applicable and possible, likewise const CString& return types can help improve code efficiency a bit. Just my thought .. Has anyone ever noted that ?
|
|
![]() |
|
Cezariusz ![]() Moderator Group ![]() ![]() Joined: 14 May 2003 Location: Poland Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() |
I didn't take note of this, but I agree with you. I'm always using const references if possible, especially for CString, because "const CString&" accepts LPCTSTR as well. I would be however much more careful with returning const CString&, because it's safe only for class members. |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |