Langbahn Team – Weltmeisterschaft

Talk:C++11: Difference between revisions

Content deleted Content added
Kxx (talk | contribs)
Line 133: Line 133:


:::Don't see how this is related. It is unlikely that contents of this article will be deleted. Rather, they may be just moved to other places. [[User:Kxx|Kxx]] ([[User talk:Kxx|talk]] | [[Special:Contributions/Kxx|contribs]]) 04:23, 4 August 2011 (UTC)
:::Don't see how this is related. It is unlikely that contents of this article will be deleted. Rather, they may be just moved to other places. [[User:Kxx|Kxx]] ([[User talk:Kxx|talk]] | [[Special:Contributions/Kxx|contribs]]) 04:23, 4 August 2011 (UTC)

:::: Well, he might have a point, since often similar content is deleted citing [[WP:NOTTEXTBOOK]] and friends, as is [[Wikipedia:Articles_for_deletion/Fflush | here]]. However, I don't think this applies to this article also.[[User:1exec1|1exec1]] ([[User talk:1exec1|talk]]) 22:54, 19 August 2011 (UTC)

Revision as of 22:54, 19 August 2011

WikiProject iconComputing Start‑class Mid‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
MidThis article has been rated as Mid-importance on the project's importance scale.
WikiProject iconC/C++ Unassessed High‑importance
WikiProject iconThis article is within the scope of WikiProject C/C++, a collaborative effort to improve the coverage of C and C++ topics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
???This article has not yet received a rating on Wikipedia's content assessment scale.
HighThis article has been rated as High-importance on the importance scale.

'const int GetFive()'

In the section about constexpr, there was the following example:

int GetFive() {return 5;}
int some_value[GetFive() + 7]; //create an array of 12 integers. illegal C++

A couple days ago, an anonymous editor changed it to add 'const' before the GetFive() definition:

const int GetFive() {return 5;}
int some_value[GetFive() + 7]; //create an array of 12 integers. illegal C++

This was just reverted by another editor. I liked the original edit that added it, so I changed it back (to include the const). I think it serves a useful pedagogical purpose.

The argument made in the revert was that a const return value doesn't matter, and the const is discarded. While true, IMO it sort of misses the point of this example. For instance, it's also true that

int five = 5;
int some_value[five + 7]; //create an array of 12 integers. illegal C++

isn't legal C++, but in some sense this is for a different reason than the non-const GetFive example. In this case, the code would be legal if you told the compiler that five was constant. In the GetFive example, the code can't be legal because there is no way to tell the compiler that GetFive returns a constant, even with the const keyword.

By having it there, it emphasizes the fact that constexpr does something more than what you already get with const.

I don't feel strongly on this issue, and I won't contest it any more if someone changes it again. EvanED (talk) 15:08, 30 July 2010 (UTC)[reply]

The problem is that however much you may want to communicate that "constexpr" is doing something more than "const" is, this example is not communicating it. This is simply because "const int GetFive()" is syntactically identical to "int GetFive()", whereas "const int five" is not syntactically identical to "int five". If you feel the body of the text is not as effective in telling the reader how "constexpr" is different from "const" as you think it could be, then a more effective way to show this is to change the text where you feel it is deficient. This change simply doesn't tell the reader what you think it can. At least, not without adding to the text itself the specific contrast between "int five" and "const int five".
That being said, I really don't care one way or another. Korval (talk) 07:50, 2 August 2010 (UTC)[reply]
Since you, EvanED, don't feel strongly about it, but I do, I took the liberty of reverting it again. "const" on the return type is a very controversial issue, and IMO has no place in this example. It's only misleading/confusing. Also it implies that "const" and "constexpr" are somewhat similar, only one more powerful than the other. This isn't so, they're almost entirely different beasts. --80.120.4.2 (talk) 17:47, 8 April 2011 (UTC)[reply]
I find this example somewhat strange. Why would one want to write
int GetFive() {return 5;}
int some_value[GetFive() + 7];

instead of

#define GetFive (5)
int some_value[GetFive + 7];

I would like to have an example where I cannot use macros. — Preceding unsigned comment added by 217.253.103.95 (talk) 15:19, 25 June 2011 (UTC)[reply]

The macro version works fine and is simple, but it has one big problem: The GetFive identifier is valid for the rest of the source file instead of just the current block. In other words, macros do not obey the normal identifier scope rules. So if your write, for example
if (bla bla bla) {
  #define GetFive (5)
  int some_value[GetFive + 7];
  ...
}
else {
   double GetFive = 3.8;
   ...
}
you will get a compiler error on the last declaration. This means that if you use macros, you need to employ a different discipline than if you use "ordinary" variables.. --Oz1cz (talk) 09:27, 26 June 2011 (UTC)[reply]

Random number generators

Where did the table of properties of random number generators come from? It looks a bit dubious; one would not expect the high-quality mersenne_twister algorithm to be "fast" if the simplistic linear_congruential algorithm is only "medium" speed. —Preceding unsigned comment added by 68.33.168.195 (talk) 00:53, 11 September 2010 (UTC)[reply]

I don't know any implementation of a Mersenne Twister that is (or has the potential to be) faster than a simple linear congruential generator. I guess the "speed" column in the table needs an update. —Preceding unsigned comment added by 134.93.143.104 (talk) 15:08, 4 January 2011 (UTC)[reply]

Don't make guesses. If you have sources supporting whichever is faster, put them in.Kxx (talk | contribs) 16:18, 4 January 2011 (UTC)[reply]

Attributes

Is it intentional that the article does not mention attributes? They are present in the latest working draft and are certainly worth being described here.--Tigrisek (talk) 23:42, 18 March 2011 (UTC)[reply]

C++11

Unless something highly unlikely happens in the standardization process, it looks like we will have C++11. However, I would suggest that, until it is actually a finished ISO standard, we should not rename/move the page to C++11. — Preceding unsigned comment added by Korval (talk • contribs) 05:06, 26 March 2011 (UTC)[reply]

Agreed. But since it's likely that people will be searching for C++11 in the near future I've gone ahead and added a redirect from there to here. When it becomes official, the redirect and page can be swapped. --Shirik (Questions or Comments?) 06:09, 8 April 2011 (UTC)[reply]
Now is the time? http://herbsutter.com/2011/08/12/we-have-an-international-standard-c0x-is-unanimously-approved/ Alexk7 (talk) 05:48, 13 August 2011 (UTC)[reply]
C++11 is by no means an official name (cf. ISO/IEC 14882:2011) and nowhere as widely used as C++0x. Kxx (talk | contribs) 06:31, 13 August 2011 (UTC)[reply]
Is there a way to get the C++11 redirect page to show up in search engine searches. As of today, 'C++11' pulls up nothing related to C++ at all on Google. 70.129.197.15 (talk) 21:11, 11 April 2011 (UTC)[reply]
Sure; just press the "make my page top of the search engine results" button at the bottom of the Google homepage. Tomalak Geret'kal (talk) 11:13, 14 April 2011 (UTC)[reply]
Agreed here too. Tomalak Geret'kal (talk) 11:13, 14 April 2011 (UTC)[reply]

FDIS: new, explicit, final, override

Herb Sutter writes that the new and explicit markers, mentioned in "Explicit virtual function overrides", have been removed and that final (which is apparently not mentioned in this article) and override remain in the language's Final Draft International Standard. (See also his full report on the FDIS, and the Slashdot post from which I learned of it.)

I guess those changes only impact that section of the article, but I'll leave it to others to edit in case I misread. --an odd name 00:18, 27 March 2011 (UTC)[reply]

Good point. When the mailing is released and the new wording made available, we can update the article more specifically as to how these things work. Right now, we just don't have the details to say how the functionality works now. Korval (talk) 01:59, 31 March 2011 (UTC)[reply]
The article has been updated to match the current version of the specification. Korval (talk) 20:56, 14 April 2011 (UTC)[reply]

Multitasking memory model

The article currently says "The memory model defines when multiple threads may access the same memory location, and specifies when updates by one thread become visible to other threads. The C++0x draft ensures sequential consistency for programs that do not explicitly specify weaker memory ordering constraints".

Depending on how this is interpreted it is either false or very misleading. The standard makes "seq_cst" the default for operations on atomic types. The quoted text however implies that every memory access (non-atomic, non-volatile) has "seq_cst" ordering by default (which is not true). --80.120.4.2 (talk) 17:25, 8 April 2011 (UTC)[reply]

I removed the parts in question. 90.146.147.218 (talk) 01:07, 22 April 2011 (UTC)[reply]

May be a quote

The section I just added a requested citation to might need to be annotated as a quote from the cited article. I'll leave that to who ever put it in the article in the first place, as this is all i have time for right now. Good Night, Good luck and God^h^h^h Thor Bless. Jjk (talk) 19:38, 28 May 2011 (UTC)[reply]

N3281 or N3291?

In two places (lead and C++ Standards Committee papers) the link (URL and link text says N3291, but the PDF linked to is N3281. Also, there is a dead link to a final draft N3290. Guy Macon (talk) 21:25, 12 June 2011 (UTC)[reply]

They're both caused by the same problem: the C++ committee has un-released the final draft and FDIS specifications. Technically, they weren't supposed to release them in the first place. The ISO cite automatically attempts to correct bad links, so it turned the N3291 link to the N3281 page. And the N3290 link is dead for similar reasons. The best bet is to just remove these links entirely. Korval (talk) 23:23, 12 June 2011 (UTC)[reply]

Noexcept

Is it possible for the article to explain noexcept? When I heard about it, I came here to find out what it does, but there isn't even a mention. Hiiiiiiiiiiiiiiiiiiiii (talk) 15:43, 2 July 2011 (UTC)[reply]

Yes, it is possible for the article to explain noexcept. Whether someone will take the time to do so is another question ;) Korval (talk) 03:15, 3 July 2011 (UTC)[reply]

The Future of this page

The standards committee is going to meet in a few weeks, and when they do, we will likely have a C++11. This will get people looking for C++11 materials, and naturally, that means hits on Wikipedia. So, what should become of this article?

The C++11 page redirects to C++0x; the obvious thing to do is reverse that, transferring this article to the C++11 page and making C++0x go there. But my question is more about content. There was discussion about certain features getting their own page, with a link from the main page. This already effectively happened with decltype. My suggestions for the others would be things that are difficult to understand or have significant corner cases:

  • r-value references. This section is a good introduction to them, but there is lots of depth and misunderstanding to the feature. Indeed, the C++0x specification currently has lots of reference types.
  • Variadic template. This article is anemic; the section here is more detailed.
  • Uniform initialization. There are a lot of corner cases with uniform initialization.

The other thing I would like to see is a section on the C++ standard library page about the enhancements. When I originally rewrote this article a few years back, I didn't really look up the material on the standard library features coming down the line. And there are some interesting changes to some old favorites (emplace member functions, for example). Korval (talk) 09:06, 29 July 2011 (UTC)[reply]

I think that this article can be kept as a directory for diffs from C++03 to C++11 like (C1X vs C99 vs C). Moving things out has long been necessary per WP:LONGWP:TOOLONG, but not all things can be treated equally. Like you have suggested, certain C++-specific features are prominent enough to warrant a separate article (r-value references, variadic templates, smart pointers). Some others that are shared with other programming languages (type inference, lambdas, ranged-based loops, memory model) can be made a section of the page on the general topic. But it seems that these are just the exception cases. For most features, they cannot go anywhere—a brief description needs to be retained even after a move, but the existing one is brief already. Kxx (talk | contribs) 15:37, 29 July 2011 (UTC)[reply]
Hi. I'm not sure whether this edit doesn't qualify as WP:SPAM or offtopic, but anyways. FYI there's a separate third-party C++ reference wiki that specializes in a more technical description of the C++ language and standard library. The great thing is that this wiki also uses Mediawiki as the backend, supports multiple languages and most importantly, uses the same licensing as Wikipedia. I think that the material, which would otherwise be deleted for reasons such as lack of notability or too much detail, could happily live in the said wiki retaining a more concise explanation here.62.212.207.242 (talk) 19:42, 3 August 2011 (UTC)[reply]
Don't see how this is related. It is unlikely that contents of this article will be deleted. Rather, they may be just moved to other places. Kxx (talk | contribs) 04:23, 4 August 2011 (UTC)[reply]
Well, he might have a point, since often similar content is deleted citing WP:NOTTEXTBOOK and friends, as is here. However, I don't think this applies to this article also.1exec1 (talk) 22:54, 19 August 2011 (UTC)[reply]