Talk:Rule of three (C++ programming)

Latest comment: 1 year ago by 92.193.248.231 in topic Rule of Zero

Disambiguation

edit
  • One of the references says Op. cit. - but which of the two others is meant?
  • copy assignment operator = copy constructor?

--Abdull (talk) 23:24, 29 February 2008 (UTC)Reply

Singleton?

edit

In my opinion the singleton design pattern isn't relevant here, the rule of three is meant to prevent bugs of oversight and not enforcing semantics (such as "only one" singleton).

Additionally as far as I know a private destructor is not part of the singleton pattern. Motti (talk) 19:34, 7 September 2009 (UTC)Reply

Agreed. It's two separate (but related) concepts. What they have in common is that they represent two situations where the implicitly generated special member functions are undesired, but for different reasons. decltype (talk) 09:36, 8 September 2009 (UTC)Reply

Marshall Cline

edit

Please consider discussing the linking of Marshall Cline instead of edit-warring. decltype (talk) 13:56, 29 June 2010 (UTC)Reply

What is the point of linking to a non-existent entry? It adds absolutely nothing to anyone reading this entry. Once there is a Marshall Cline entry by all means link to it but until it exists a dead link is only distracting. Motti (talk) 10:47, 30 June 2010 (UTC)Reply
The relevant guideline is WP:RED. In short, a red link is usually appropriate if the target is a notable subject in its own right. The question then becomes whether Cline is notable. I think he may be, but I'd say it's a borderline case. For this reason I did not link when I initially added the info to the article. decltype (talk) 11:06, 30 June 2010 (UTC)Reply
From what I can see in a quick search Mr. Cline wrote the C++ FAQ Lite (and one book called C++ FAQs), this doesn't appear to be enough to be note worthy. Motti (talk) 08:07, 1 July 2010 (UTC)Reply
Over a year later this is still a red link, I will unlink in accordance to Red links to personal names should be avoided. Motti (talk) 06:44, 28 November 2011 (UTC)Reply

Rule of three becomes rule of five in C++0x

edit

In addition to the already-mentioned operators, there is also the move constructor and the move assignment operator. (http://stackoverflow.com/questions/4782757/rule-of-three-becomes-rule-of-five-with-c11) I think this should be mentioned in the article. 136.186.217.27 (talk) 05:45, 22 January 2013 (UTC)Reply

Example not an example

edit

Unless I'm missing something, the example code doesn't define an assignment operator... so it's not a good example for the Rule of three that this article is about! -- pne (talk) 12:09, 7 February 2013 (UTC)Reply

Awesome call. I think I've fixed it! Pixor (talk) 02:13, 8 February 2013 (UTC)Reply


This example doesn't cater well to programmers without an extensive knowledge of C++. Perhaps I'm an idiot and just haven't immersed myself in "standard" c++ example code, but the syntax here is woefully confusing, and I've been coding in this language for a while now. A simpler example might help others understand what's going on here. Ryantuck (talk) 22:38, 11 February 2013 (UTC)Reply


The example is also wrong. The assign operator invalidates the "other" object due to the idiotic swap that is most likely supposed to be the copy-swap-idion (but isn't). 194.156.172.203 (talk) 09:02, 11 March 2013 (UTC)Reply

Ten years down and there is still no example but it is also still mentioned in the text. :-/ JB. --92.193.248.231 (talk) 14:54, 8 February 2023 (UTC)Reply

Rule of Zero

edit

Staszek Lem (talk · contribs) recently removed a section on the "Rule of Zero" (see diff), giving "WP:UNDUE from self-published source" as reason. I disagree and believe that "Rule of Zero" has quickly become an established term in "C++ folklore". However, I am having trouble finding sources that would establish the notability of that term: Other than the original article that coined that term (cited on isocpp.org) and a couple of blog posts ([1], [2], [3], [4]), there's Juan Alday's article in #120 (from April 2014) of Overload, the magazine published by ACCU, and a blog post by Scott Meyers. What do other readers think?– Tea2min (talk) 11:16, 16 August 2016 (UTC)Reply

That's the whole problem with folklore: it is ...er... folklore. And until a "notable folklorist" reports that it is a notable folklore, it is WP:UNDUE. Staszek Lem (talk) 19:03, 16 August 2016 (UTC)Reply
I'll probably get flak for this, but to me the entire topic here is rather religious folklore. Not sure how "ruly" these rules are in reality, how many people follow them, hell, how many programmers even really understand them. Coding professionally in C++ since about 1990 and today I hear about those for the first time :-). So I wonder how relevant all this topic actually is. JB. --92.193.248.231 (talk) 15:03, 8 February 2023 (UTC)Reply