Type of result: const or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

	Scott Meyers recommends in his "50 specific ways ..." book that a
const typed object be returned from an operator. For instance,

const obj operator + (const obj& A, const obj& B);

	By doing so, things like below would be banned by the type-checker.
(a+b) = c;

	However, the stl with g++ does not return a const type, at least
in the complex and string cases. My questions is: which style is the
better one to follow?

thanks,

Wei



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux