Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - possible Improvement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

possible Improvement

 Post Reply Post Reply
Author
Message
redRyder View Drop Down
Newbie
Newbie
Avatar

Joined: 07 January 2004
Location: Pakistan
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote redRyder Quote  Post ReplyReply Direct Link To This Post Topic: possible Improvement
    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 ? 

 

Back to Top
Cezariusz View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 14 May 2003
Location: Poland
Status: Offline
Points: 16
Post Options Post Options   Thanks (0) Thanks(0)   Quote Cezariusz Quote  Post ReplyReply Direct Link To This Post Posted: 20 January 2004 at 5:31am

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.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.