- Feature Articles
- CodeSOD
-
Error'd
- Most Recent Articles
- Retry Fail
- Office Politics
- Secret Horror
- Not Impossible
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
Hmm.
OK. I'm not really happy about
ra
as a variable name for a shared-pointer-to-Assignment, but it's not an interesting mistake. Maybe there's a good reason for calling it that beyond simply an abbreviation for "reference-to-Assignment" (which it isn't, which is why I'm not happy about it).What bothers me is the article's blatant dismissal of using
Assignment::Ptr
instead ofboost::shared_ptr<Assignment>
, but even more, its unconditional dismissal ofAssignment::makeAssignment(...)
. After all, whether it's C++ before C++11 (using Boost) or C++11+ (using the STL), the library provides a function to construct a new shared pointer and return a pointer to it. It's calledthe_right_namespace::make_shared<T>(...)
with the forwarding (to the constructor) done in a way that's appropriate to the C++-version in use (perfect forwarding in C++11+, hypertemplated overloads in C++<11).That means that the only arguments are about snake_case versus camelCase, and whether
make_shared<Assignment>(...)
is better or worse thanmakeAssignment(...)
. I'm actually opposed, on the grounds of DRY, to having the function be a static member function ofAssignment
, and would much prefer it to be a namespace level function outside the class. It's not like it has to be a friend or anything stupid like that - it's just a forwarder-to-constructor.But the whitespace is definitely toothgrindingly stupid.
Edit Admin
Sure be nice if there was a pretty-formatter you could run over your codebase and a source control diff engine that could intelligently ignore syntactically insignificant whitespace changes.
Addendum 2025-02-05 09:30: I'd also like complete buy-in from my entire dev team on which format standard we use going forward.
I also want a pony.