Difference between revisions of "Talk:Main Page/suggestions"
(Undo revision 160475 by 94.23.146.47 (talk)) |
|||
Line 1: | Line 1: | ||
− | # | + | This page collects edit suggestions from new and logged-out users when editing is temporarily disabled due to vandalism. Click the "+" at the top to leave a message. Please make sure to include a link to the page you are referencing. See [[/archive]] and [[/archive 1]] for old suggestions that have been responded to. |
+ | {{archiveme | ||
+ | |counter=1 | ||
+ | |archive=Talk:Main Page/suggestions/archive %(counter)d | ||
+ | }} | ||
+ | == noexcept specifier == | ||
+ | |||
+ | The description of functions with an implicit non-throwing exception specifier is not complete. Implicitly declared constructors and assignment operators are omitted. Also comparison operators that are defaulted on their first declaration is omitted. Furthermore it unnecessarily lists categories of constructors and assignment operators. | ||
+ | :{{done}} (more precise wording might be required) The categories is listed because they link to different pages. [[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 20:39, 21 April 2019 (PDT) | ||
+ | |||
+ | == Expression SFINAE DR339 / N2634 == | ||
+ | |||
+ | I would like to add ''Expression SFINAE'' as a C++11 feature: [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2634.html N2634] | ||
+ | |||
+ | Supported in: | ||
+ | GCC 4.4, | ||
+ | clang 2.9, | ||
+ | MSVC: no/partial support. In particular, no support for decltype [temp.deduct]/7 up to 19.15. | ||
+ | [https://devblogs.microsoft.com/cppblog/expression-sfinae-improvements-in-vs-2015-update-3/ source] | ||
+ | |||
+ | [[User:Rustyx|Rustyx]] ([[User talk:Rustyx|talk]]) 12:40, 22 February 2019 (PST) | ||
+ | |||
+ | : what's missing from its current description in [[cpp/language/sfinae#Expression_SFINAE]]? --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 12:46, 22 February 2019 (PST) | ||
+ | :: I think Rustyx means to add a new row in [[cpp/compiler support]]. [[User:T. Canens|T. Canens]] ([[User talk:T. Canens|talk]]) 10:02, 23 February 2019 (PST) | ||
+ | ::: Indeed that's what I meant, [[cpp/compiler support]]. Can't post on that page, unfortunately. [[User:Rustyx|Rustyx]] ([[User talk:Rustyx|talk]]) 10:48, 24 February 2019 (PST) | ||
+ | |||
+ | :Added (partially). I don't know whether IBM XL C++, Sun/Oracle C++ or HP aCC support expression SFINAE, or in which edition they began to support. If anyone knows, please improve it. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 03:57, 25 April 2019 (PDT) | ||
+ | |||
+ | == Permission for editing: Compiler support == | ||
+ | |||
+ | I would like to add the Apple Clang/Xcode column to the compiler support page now. Thanks in advance for permissions.--[[User:Buovjaga|Buovjaga]] ([[User talk:Buovjaga|talk]]) 02:25, 23 February 2019 (PST) | ||
+ | : I don't think I have the technical ability to manually grant permissions. If you post the edits here, I can copy them over. (Although by the time you are done posting them here you may well have accumulated enough edits to get past the threshold...) [[User:T. Canens|T. Canens]] ([[User talk:T. Canens|talk]]) 10:00, 23 February 2019 (PST) | ||
+ | :: I gave this a lot of thought, but I am afraid I cannot bring myself to do it. The work will require possibly creating multiple templates. I cannot reason about this in theory, I need to be able to see the effects of the templates live. Even if I could, I would essentially be writing a complex tutorial on doing the edits, which seems like a massive waste of effort. I will be waiting for the editing permissions. [[User:Buovjaga|Buovjaga]] ([[User talk:Buovjaga|talk]]) 05:49, 3 March 2019 (PST) | ||
+ | ::: After more thought, I will attempt to describe what should be done. I hope someone can pick this up. The goal is to create a new column named Apple Clang, perhaps after the existing Clang column. It would contain the Apple Clang version number and show the Xcode version number in a tooltip (hint). Steps below: | ||
+ | :::# Add the column to [[Template:compiler_support_row]] <s>and</s> <tt><s><nowiki>[[Template:compiler_support_top]]</nowiki></s></tt> and the compiler name to [[Template:compiler support]] (edited by --[[User:Space Mission|Space Mission]] ([[User talk:Space Mission|talk]]) 05:01, 6 September 2023 (PDT)) | ||
+ | |||
+ | ::::: A note from 2023: After recent updates to [[Template:compiler support]] there is no need to edit the (deprecated) templates <tt><nowiki>[[Template:compiler support top]]</nowiki></tt> and <tt><nowiki>[[Template:compiler support bottom]]</nowiki></tt>. If necessary, modify the compilers list directly in [[Template:compiler support]] (all in one place). So, I stroke out the second link above (also removing [[Special:WhatLinksHere/Template:compiler_support_top|link-dependency]]). --[[User:Space Mission|Space Mission]] ([[User talk:Space Mission|talk]]) 05:01, 6 September 2023 (PDT) | ||
+ | |||
+ | :::# Possibly add a new template in the style of [[Template:msvc_ver]]. I don't know the best way to design it so it would accept the Apple Clang and Xcode versions. | ||
+ | :::# In the actual article, add "yes" entries for std::any, std::variant and std::optional with Apple Clang version 10.0.0 and Xcode version 10.0 | ||
+ | :::# Add a "no" entry for std::filesystem | ||
+ | :::# Add to references: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions and https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes | ||
+ | :::--[[User:Buovjaga|Buovjaga]] ([[User talk:Buovjaga|talk]]) 05:37, 19 March 2019 (PDT) | ||
+ | ::::I think you have enough edits now to get past the threshold and make the edits directly, just FYI. [[User:T. Canens|T. Canens]] ([[User talk:T. Canens|talk]]) 20:58, 19 March 2019 (PDT) | ||
+ | |||
+ | == new expression missing exception specs == | ||
+ | |||
+ | Somewhere way down in that wall of text there is a mention of std::bad_array_new_length, but that's it. I think there should be a dedicated section "Exceptions" (as in other docs on this site) documenting std::bad_alloc and std::bad_array_new_length as well as the non-throwing versions, as this is pretty fundamental. Perhaps also an example. | ||
+ | |||
+ | Thanks! | ||
+ | [[Special:Contributions/213.68.42.195|213.68.42.195]] 03:02, 25 February 2019 (PST) | ||
+ | |||
+ | |||
+ | |||
+ | == New user == | ||
+ | |||
+ | Hello, I would like to make changes to the [https://en.cppreference.com/w/cpp/compiler_support C++ compiler support] page related to the addition of the "Modules" and "Coroutines" features to C++20. Can somebody give me permissions to edit or otherwise do the changes as per the following articles: | ||
+ | |||
+ | https://www.phoronix.com/scan.php?page=news_item&px=Coroutines-Modules-CPP20 | ||
+ | https://herbsutter.com/2019/02/23/trip-report-winter-iso-c-standards-meeting-kona/ | ||
+ | |||
+ | --[[User:Trifud|Trifud]] ([[User talk:Trifud|talk]]) 23:15, 26 February 2019 (PST) | ||
+ | :How long time does it take for a user to be activated? --[[User:Trifud|Trifud]] ([[User talk:Trifud|talk]]) 23:09, 28 February 2019 (PST) | ||
+ | |||
+ | == RFC: another implementation of Gadget-StandardRevision == | ||
+ | |||
+ | |||
+ | {{cot|source code}} | ||
+ | <source lang=jquery> | ||
+ | (function() { | ||
+ | 'use strict'; | ||
+ | var styles = document.createElement('style'); | ||
+ | styles.textContent = '[hidden] { display: none !important; }'; | ||
+ | styles.textContent += '.stdrev-rev-hide > tbody > tr > td { border: none !important; padding: 0 !important; }' | ||
+ | styles.textContent += '.stdrev-rev-hide > tbody > tr > td:nth-child(2) { display: none; }' | ||
+ | styles.textContent += '.stdrev-rev-hide { border: none; }' | ||
+ | styles.textContent += '.stdrev-rev-hide > span > .t-mark-rev { display: none; }' | ||
+ | document.head.append(styles); | ||
+ | |||
+ | var rev = mw.config.get('wgTitle').indexOf('c/') === 0 ? | ||
+ | [ 'C89', 'C99', 'C11' ] : | ||
+ | [ 'C++98', 'C++03', 'C++11', 'C++14', 'C++17', 'C++20' ]; | ||
+ | |||
+ | var select = $('<div class="vectorMenu"></div>').appendTo('#cpp-head-tools-right'); | ||
+ | select.append('<h5><span>Std rev</span></h5>'); | ||
+ | var list = $('<ul>').appendTo($('<div class="menu">').appendTo(select)); | ||
+ | $.each(['DIFF'].concat(rev), function(i, v) { | ||
+ | list.append('<li><a href="#'+v+'">'+v+'</a></li>'); | ||
+ | }); | ||
+ | list.on('click', 'a', function(e) { | ||
+ | list.find('a').css('font-weight', 'normal'); | ||
+ | $(this).css('font-weight', 'bold'); | ||
+ | curr_rev = e.target.innerText; | ||
+ | on_rev_changed(); | ||
+ | }); | ||
+ | |||
+ | var curr_rev = 'DIFF'; | ||
+ | |||
+ | // Returns true if an element should be shown in the current revision, that is, either curr_rev is | ||
+ | // DIFF (i.e. show all), or curr_rev is within the range [since, until). The range [since, until) | ||
+ | // is inspected from the classes of `el`. | ||
+ | // `el` may be the same element as the one to be shown if it has the needed classes, or it may be a | ||
+ | // revision marker or a collection thereof (e.g. one expanded from {{mark since foo}}, or from the | ||
+ | // {{mark since foo}}{{mark until bar}} combo). | ||
+ | // `el` may be either a HTML element or a jQuery object. | ||
+ | // Note that this correctly handle the case when `el` represents an empty set of elements (in which | ||
+ | // case the element is always shown). | ||
+ | function should_be_shown(el) { | ||
+ | if (curr_rev === 'DIFF') return true; | ||
+ | var curr_revid = rev.indexOf(curr_rev); | ||
+ | var since = 0, until = rev.length; | ||
+ | $.each(rev, function(i) { | ||
+ | var ssince = 't-since-'+rev[i].toLowerCase().replace(/\+/g, 'x'); | ||
+ | var suntil = 't-until-'+rev[i].toLowerCase().replace(/\+/g, 'x'); | ||
+ | if ($(el).hasClass(ssince)) since = i; | ||
+ | if ($(el).hasClass(suntil)) until = i; | ||
+ | }); | ||
+ | return since <= curr_revid && curr_revid < until; | ||
+ | } | ||
+ | |||
+ | // Called when user changes the selected revision. Inside this function, curr_rev is already set to | ||
+ | // the value after the change. | ||
+ | function on_rev_changed() { | ||
+ | handle_dcl(); | ||
+ | renumber_dcl(); | ||
+ | handle_dsc(); | ||
+ | handle_nv(); | ||
+ | handle_rev(); | ||
+ | handle_headings(); | ||
+ | handle_list_items(); | ||
+ | $('.t-rev-begin, .t-rev-inl').toggleClass('stdrev-rev-hide', curr_rev !== 'DIFF'); | ||
+ | $('.t-mark-rev').each(function() { | ||
+ | this.hidden = curr_rev !== 'DIFF'; | ||
+ | if ($(this.nextSibling).is('br')) | ||
+ | this.nextSibling.hidden = curr_rev !== 'DIFF'; | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Returns true if the jQuery object `el` contains at least one element, and all contained elements | ||
+ | // are hidden; otherwise returns false. | ||
+ | // This is used to hide a 'parent' or 'heading' element when all its contents are hidden. | ||
+ | function all_hidden(el) { return $(el).length > 0 && !$(el).is(':not([hidden])'); } | ||
+ | |||
+ | // Hide or show the elements expanded from the {{dcl ...}} template family. See documentation at | ||
+ | // https://en.cppreference.com/w/Template:dcl/doc . | ||
+ | // The dcl items (expanded from {{dcl | ... }}) may either appear alone or as children of versioned | ||
+ | // declaration list (expanded from {{dcl rev begin | ... }}). In the latter case, the revision may | ||
+ | // be supplied by the dcl items or by the dcl-rev (in the latter case the dcl-rev has class | ||
+ | // t-dcl-rev-notes). | ||
+ | // For the use of renumber_dcl(), each dcl-rev is marked as hidden if all its children dcl items | ||
+ | // are hidden, and vice versa. | ||
+ | function handle_dcl() { | ||
+ | $('.t-dcl').each(function() { | ||
+ | this.hidden = !should_be_shown(this); | ||
+ | }); | ||
+ | $('.t-dcl-rev').each(function() { | ||
+ | if ($(this).is('.t-dcl-rev-notes')) { | ||
+ | var hidden = !should_be_shown(this); | ||
+ | this.hidden = hidden; | ||
+ | $(this).find('.t-dcl').each(function() { | ||
+ | this.hidden = hidden; | ||
+ | }); | ||
+ | } else { | ||
+ | this.hidden = all_hidden($(this).find('.t-dcl')); | ||
+ | } | ||
+ | }); | ||
+ | $('.t-dcl-begin .t-dsc-header').each(function() { | ||
+ | var marker = $(this).find('> td > div > .t-mark-rev'); | ||
+ | var lastheader = $(this).nextUntil(':not(.t-dsc-header)').addBack(); | ||
+ | var elts = lastheader.nextUntil('.t-dsc-header').filter('.t-dcl, .t-dcl-rev'); | ||
+ | this.hidden = all_hidden(elts) || !should_be_shown(marker); | ||
+ | }); | ||
+ | $('.t-dcl-h').each(function() { | ||
+ | this.hidden = all_hidden($(this).nextUntil(':not(.t-dcl, .t-dcl-rev)')); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // Ensure that each visible dcl item in a dcl list is contiguously numbered, and rewrite mentions | ||
+ | // to these numbers to use the modified numbering. | ||
+ | // If a list item (e.g. those expanded from @m@) contains no number after the rewrite (i.e. it's | ||
+ | // inapplicable in current revision), it is hidden. | ||
+ | // Note that the use of '~ * .t-li, ~ * .t-v' effectively establishes a kind of scoping: only | ||
+ | // numbers that appear after the dcl list and are more nested in the DOM hierarchy are affected | ||
+ | // by the renumbering. | ||
+ | // Requires that handle_dcl() has been called. | ||
+ | function renumber_dcl() { | ||
+ | $('.t-dcl-begin').each(function() { | ||
+ | var numbering_map = []; | ||
+ | var i = 0; | ||
+ | $(this).find('.t-dcl, .t-dcl-rev').each(function() { | ||
+ | var num_cell; | ||
+ | if ($(this).is('.t-dcl')) | ||
+ | num_cell = $(this).children('td:nth-child(2)'); | ||
+ | else | ||
+ | num_cell = $(this).find('> tr.t-dcl-rev-aux > td:nth-child(2)'); | ||
+ | var number_text = /\s*\((\d+)\)\s*/.exec(num_cell.text()); | ||
+ | if (!num_cell.attr('data-orig-num') && number_text) | ||
+ | num_cell.attr('data-orig-num', number_text[1]); | ||
+ | var original_num = num_cell.attr('data-orig-num'); | ||
+ | if (original_num) { | ||
+ | if (! numbering_map[original_num]) | ||
+ | numbering_map[original_num] = $(this).is('[hidden]') ? null : ++i; | ||
+ | num_cell.text('('+numbering_map[original_num]+')'); | ||
+ | } | ||
+ | }); | ||
+ | $(this).find('~ * .t-li, ~ * .t-v').each(function() { | ||
+ | if (! $(this).attr('data-orig-v')) | ||
+ | $(this).attr('data-orig-v', $(this).text().replace(/[()]/g, '')); | ||
+ | var original_numbers = []; | ||
+ | $.each($(this).attr('data-orig-v').split(','), function(i, v) { | ||
+ | var match = /(\d+)(?:-(\d+))?/.exec(v); | ||
+ | if (match[2]) | ||
+ | for (var i = +match[1]; +i <= +match[2]; ++i) | ||
+ | original_numbers.push(i); | ||
+ | else | ||
+ | original_numbers.push(match[1]); | ||
+ | }); | ||
+ | var numbers = $.map(original_numbers, function(x) { | ||
+ | return numbering_map[x]; | ||
+ | }); | ||
+ | var s = []; | ||
+ | for (var i = 0; i < numbers.length; ++i) { | ||
+ | if (numbers[i+1] - numbers[i] === 1 && numbers[i+2] - numbers[i+1] === 1) { | ||
+ | var begin = numbers[i]; | ||
+ | while (numbers[i+1] - numbers[i] === 1) | ||
+ | ++i; | ||
+ | s.push(begin+'-'+numbers[i]); | ||
+ | } else { | ||
+ | s.push(numbers[i]); | ||
+ | } | ||
+ | } | ||
+ | if ($(this).is('.t-li')) { | ||
+ | this.parentElement.hidden = numbers.length === 0; | ||
+ | $(this).text(s.join(',')+')'); | ||
+ | } else | ||
+ | $(this).text('('+s.join(',')+')'); | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | // Hide or show the elements expanded from the {{dsc ...}} template family. See documentation at | ||
+ | // https://en.cppreference.com/w/Template:dcl/doc . | ||
+ | // The revision markers are in the first cell of each dsc item. In the general case, the visibility | ||
+ | // of a dsc item is control by a single revision marker. But if a specialized template is used, | ||
+ | // and the amount of entity names in the first cell matches the lines of the revision markers, | ||
+ | // then each line controls the visibility of a single entity name, and the dsc item is hidden only | ||
+ | // if all the entity names are hidden. | ||
+ | // If all the dsc items are hidden, then the corresponding headings are hidden as well. | ||
+ | function handle_dsc() { | ||
+ | $('.t-dsc').each(function() { | ||
+ | var member = $(this).find('.t-dsc-member-div'); | ||
+ | if (member[0]) { | ||
+ | var lines = member.find('> div:nth-child(2) > .t-lines').children(); | ||
+ | var mems = member.find('> div:first-child .t-lines').children(); | ||
+ | if (lines.length !== mems.length) | ||
+ | this.hidden = !should_be_shown(lines.children('.t-mark-rev')); | ||
+ | else { | ||
+ | lines.each(function(i) { | ||
+ | var marker = $(this).children('.t-mark-rev'); | ||
+ | mems[i].hidden = !should_be_shown(marker); | ||
+ | marker.hidden = !should_be_shown(marker); | ||
+ | }); | ||
+ | this.hidden = all_hidden(mems); | ||
+ | } | ||
+ | } else { | ||
+ | var marker = $(this).find('> td:first-child > .t-mark-rev'); | ||
+ | this.hidden = !should_be_shown(marker); | ||
+ | } | ||
+ | }); | ||
+ | $('.t-dsc .t-dsc-header').each(function() { | ||
+ | var marker = $(this).find('> td > div > .t-mark-rev'); | ||
+ | var lastheader = $(this).nextUntil(':not(.t-dsc-header)').addBack(); | ||
+ | this.hidden = all_hidden(lastheader.nextUntil(':not(.t-dsc)')) || !should_be_shown(marker); | ||
+ | }); | ||
+ | var heading_selector = ['tr:has(> td > h5)', 'tr:has(> td > h3)']; | ||
+ | $.each(heading_selector, function(i, selector) { | ||
+ | $(selector).each(function() { | ||
+ | var section = $(this).nextUntil(heading_selector.slice(i).join(',')); | ||
+ | this.hidden = all_hidden(section.filter('.t-dsc')); | ||
+ | }); | ||
+ | }); | ||
+ | $('.t-dsc-begin').each(function() { | ||
+ | this.hidden = all_hidden($(this).find('.t-dsc')); | ||
+ | }); | ||
+ | } | ||
+ | // Hide or show the navbar elements expanded from the {{nv ...}} template family. See documentation | ||
+ | // at https://en.cppreference.com/w/Template:nv/doc . | ||
+ | // A line of revision marker only controls a single entity name, even if it's expanded from | ||
+ | // {{nv ln | ... }} that contains multiple lines. | ||
+ | // If a heading contains a revision marker, that revision marker controls the visibility of the | ||
+ | // heading and its corresponding contents; otherwise the heading is hidden when it is followed by | ||
+ | // content elements, and all of them are hidden. | ||
+ | function handle_nv() { | ||
+ | $('.t-nv').each(function() { | ||
+ | var marker = $(this).find('> td > .t-mark-rev'); | ||
+ | this.hidden = !should_be_shown(marker); | ||
+ | }); | ||
+ | $('.t-nv-ln-table').each(function() { | ||
+ | var lines = $(this).find('> div:nth-child(2) > .t-lines').children(); | ||
+ | var mems = $(this).find('> div:first-child .t-lines').children(); | ||
+ | lines.each(function(i) { | ||
+ | var marker = $(this).children('.t-mark-rev'); | ||
+ | if (mems[i]) mems[i].hidden = !should_be_shown(marker); | ||
+ | marker.hidden = !should_be_shown(marker); | ||
+ | }); | ||
+ | this.hidden = all_hidden(mems); | ||
+ | }); | ||
+ | var heading_selector = ['.t-nv-h2', '.t-nv-h1']; | ||
+ | $.each(heading_selector, function(i, selector) { | ||
+ | $(selector).each(function() { | ||
+ | var section = $(this).nextUntil(heading_selector.slice(i).join(',')); | ||
+ | var marker = $(this).find('> td > .t-mark-rev'); | ||
+ | if (marker[0]) { | ||
+ | section.each(function() { | ||
+ | this.hidden = this.hidden || !should_be_shown(marker); | ||
+ | }); | ||
+ | this.hidden = !should_be_shown(marker); | ||
+ | } | ||
+ | this.hidden = all_hidden(section.find('.t-nv-ln-table')); | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | // Hide or show the elements expanded from the {{rev ...}} template family. See documentation at | ||
+ | // https://en.cppreference.com/w/Template:dcl/doc . | ||
+ | // Borders are handled by class stdrev-rev-hide. | ||
+ | function handle_rev() { | ||
+ | $('.t-rev, .t-rev-inl').each(function() { | ||
+ | this.hidden = !should_be_shown(this); | ||
+ | }); | ||
+ | } | ||
+ | // Hide or show headings. | ||
+ | // If the heading contains a revision marker, that revision marker controls the visibility of it | ||
+ | // and its corresponding contents; otherwise, a heuristic is made: if the contents contain a dsc | ||
+ | // list, and its revision-related contents are hidden, then the heading and all contents are hidden | ||
+ | // as well. | ||
+ | // The heuristic requires that handle_dsc() and handle_rev() have been called. | ||
+ | function handle_headings() { | ||
+ | var heading_selector = ['h5', 'h4', 'h3', 'h2']; | ||
+ | $.each(heading_selector, function(i, selector) { | ||
+ | $(selector).each(function() { | ||
+ | var section = $(this).nextUntil(heading_selector.slice(i).join(',')); | ||
+ | var marker = $(this).find('> span > .t-mark-rev'); | ||
+ | if (marker[0]) { | ||
+ | section.each(function() { | ||
+ | this.hidden = this.hidden || !should_be_shown(marker); | ||
+ | }); | ||
+ | this.hidden = !should_be_shown(marker); | ||
+ | } | ||
+ | if (section.is('.t-dsc-begin') && !section.is(':not(p, .t-rev-begin, .t-dsc-begin)')) { | ||
+ | var revisioned_content = section.find('.t-dsc, .t-rev, .t-rev-inl'); | ||
+ | section.each(function() { | ||
+ | this.hidden = this.hidden || all_hidden(revisioned_content); | ||
+ | }); | ||
+ | this.hidden = all_hidden(revisioned_content); | ||
+ | } | ||
+ | }); | ||
+ | }); | ||
+ | } | ||
+ | // Hide or show <li> elements based on the contained revision markers. | ||
+ | function handle_list_items() { | ||
+ | $('li').each(function() { | ||
+ | var marker = $(this).children('.t-mark-rev'); | ||
+ | this.hidden = !should_be_shown(marker); | ||
+ | }); | ||
+ | } | ||
+ | })(); | ||
+ | </source> | ||
+ | {{cob}} | ||
+ | |||
+ | Features include: | ||
+ | |||
+ | # hide section based on revision markers in the heading | ||
+ | # hide <li> based on its contained revision markers | ||
+ | # hide "Defined in header ..." when the corresponding entities are hidden | ||
+ | # implement renumbering inside {{tl|v}} | ||
+ | # ''much'' shorter than P12's implementation! (~300LOC vs ~1800LOC) | ||
+ | |||
+ | Does it make sense to include this as an "official" gadget? | ||
+ | |||
+ | --[[Special:Contributions/223.3.167.101|223.3.167.101]] 10:25, 3 March 2019 (PST) | ||
+ | :We don't want to have two gadgets for the same thing. What does the current gadget do that this script doesn't, and vice versa? What caused the drastic shortening? [[User:T. Canens|T. Canens]] ([[User talk:T. Canens|talk]]) 11:07, 23 March 2019 (PDT) | ||
+ | |||
+ | :: > What does the current gadget do that this script doesn't | ||
+ | :: 1. be hosted on GitHub | ||
+ | :: 2. have tests | ||
+ | :: With regard to functionality, I don't know of any case that is handled better by Gadget-StandardRevision than by this script, but I don't have a thorough test. | ||
+ | :: > and vice versa? | ||
+ | :: All features mentioned above. Also, it does not have the problem reported [[#Standard_Revision_gadget_problems_with_C++20|below]]: Gadget-StandardRevision ignores all except the first revision marker in a row, and behaves unintuitively when the markers occupy more rows than the names in the dsc item. This script takes care to handle these cases better. | ||
+ | :: > What caused the drastic shortening? | ||
+ | :: Gadget-StandardRevision clones each of the elements that may be affected by the Gadget, and has a complex data structure to keep track of these elements and their clones. A lot of work is done to construct, manipulate, and debug this data structure. By contrast, this implementation directly manipulates the affected elements, which requires much less lines of code. | ||
+ | :: --[[Special:Contributions/121.249.15.21|121.249.15.21]] 10:52, 24 March 2019 (PDT) | ||
+ | ::: The current gadget is also hosted on GitHub and has tests https://github.com/p12tic/cppreference-doc --[[User:Ybab321|Ybab321]] ([[User talk:Ybab321|talk]]) 10:30, 26 March 2019 (PDT) | ||
+ | :::: Right, so I listed it as a thing that the current gadget do that this script doesn't :) --[[Special:Contributions/121.249.15.75|121.249.15.75]] 11:38, 26 March 2019 (PDT) | ||
+ | ::::: Oops, my mistake :( --[[User:Ybab321|Ybab321]] ([[User talk:Ybab321|talk]]) 06:44, 31 March 2019 (PDT) | ||
+ | |||
+ | == Search: noreturn - does not find en.cppreference.com/w/cpp/language/attributes/noreturn == | ||
+ | |||
+ | How can I update the search system? | ||
+ | |||
+ | Several times I have searched for terms & not found them only to Google them & be given a cppreference page. | ||
+ | |||
+ | Also `Search: fallthrough` does not find en.cppreference.com/w/cpp/language/attributes/fallthrough. | ||
+ | |||
+ | And `Search: if constexpr` does not find en.cppreference.com/w/cpp/language/if. | ||
+ | |||
+ | I’m sure that there are more ... | ||
+ | |||
+ | [[User:Chris0|Chris0]] ([[User talk:Chris0|talk]]) 18:50, 5 March 2019 (PST) | ||
+ | |||
+ | |||
+ | == Updating the Embarcadero column == | ||
+ | |||
+ | I'm a newly registered user, so cannot edit this page as it's under protection. | ||
+ | |||
+ | The Embarcadero column for C++14 and C++17 is out of date. The compiler supports all of C++14, and all of C++17 bar: | ||
+ | * Replacement of class objects containing reference members P0137R1 | ||
+ | * Standardization of Parallelism TS P0024R2 | ||
+ | * Elementary string conversions P0067R5 | ||
+ | * Splicing Maps and Sets P0083R3 | ||
+ | * Hardware interference size P0154R1 | ||
+ | |||
+ | More info here: http://docwiki.embarcadero.com/RADStudio/Rio/en/Modern_C%2B%2B_Language_Features_Compliance_Status#C.2B.2B14_Features | ||
+ | and | ||
+ | http://docwiki.embarcadero.com/RADStudio/Rio/en/Modern_C%2B%2B_Language_Features_Compliance_Status#C.2B.2B17_Features | ||
+ | : yes, their new compilers are basically Clang: Embarcadero 10.1 is Clang 3.3, Embarcadero 10.3 (linked above) is Clang 5.0. But I suppose it's fair to update the table (for now, I updated the links below the table) --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 06:40, 8 March 2019 (PST) | ||
+ | |||
+ | == Standard Revision gadget problems with C++20 == | ||
+ | |||
+ | It seems there are some problems with displaying (not displaying) features removed in C++20, | ||
+ | On std::allocator page choosing C++20 Standard to be displayed, every removed feature is still on the list, marked as deprecated, information "removed in C++20" disappears. Is this template problem or widget problem? | ||
+ | [[User:Kaznov|Kaznov]] ([[User talk:Kaznov|talk]]) 09:38, 15 March 2019 (PDT) | ||
+ | |||
+ | |||
+ | == Shall we clarify on copy functions of standard exception classes? == | ||
+ | {{collapse top|Done}} | ||
+ | It seems that the existence and the postcondition of copy functions of standard exception classes ([http://eel.is/c++draft/exception#2 exception/2]) are not mentioned in cppreference. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 02:33, 31 March 2019 (PDT) | ||
+ | {{collapse bottom}} | ||
+ | : I've added corresponding contents myself. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 23:14, 25 April 2020 (PDT) | ||
+ | |||
+ | == sizeof parameter can't be a C-style cast == | ||
+ | |||
+ | I'm not able to make this change, but would like to suggest it. | ||
+ | |||
+ | sizeof's notes ought to say something like: | ||
+ | |||
+ | With form (2), {{spar|expression}} cannot be a {{ltt|cpp/language/explicit_cast|C-style cast}}, due to ambiguity with form (1). In other words, {{c|sizeof (char)+1}} is parsed as {{c|(sizeof(char)) + 1}}, rather than {{c|sizeof((char)+1)}}. <small><span class="autosigned">— Preceding unsigned comment added by [[User:Myria|Myria]] ([[User talk:Myria|talk]] • [[Special:Contributions/Myria|contribs]]) </span></small><!-- Template:Unsigned --> | ||
+ | |||
+ | == std::sort() should mention strict weak ordering requirements == | ||
+ | |||
+ | The description of std::sort() does not mention that the comparison operator comp must define a strict weak ordering. Unless the standard has changed, it is undefined behavior to sort with a comparison function which does not define a strict weak ordering. | ||
+ | |||
+ | It also is probably worthwhile to explicitly point out that sorting with a comparison function that does not define a strict weak ordering is undefined behavior, and in fact in common implementations can lead to a crash or infinite loop, since it's a [https://stackoverflow.com/questions/18291620/why-will-stdsort-crash-if-the-comparison-function-is-not-as-operator really commonly-encountered pitfall]. | ||
+ | |||
+ | It may also be worthwhile pointing out that operator< does *not* define a strict weak ordering over floating point values due to NaN behavior, and so std::sort() may crash when applied to a vector of floating point values. | ||
+ | |||
+ | I believe that std::stable_sort() has implementation defined behavior rather than undefined when there's not a strict weak ordering, so it might also be worthwhile recommending using std::stable_sort() in such cases. | ||
+ | |||
+ | [[User:Sethml|SethML]] ([[User talk:Sethml|talk]]) 10:41, 9 April 2019 (PDT) | ||
+ | : [[cpp/algorithm/sort]] says "Compare must meet the requirements of [[cpp/named_req/Compare|Compare]]." and [[cpp/named_req/Compare]] explains strict weak ordering and all other requirements on the comparison function. I suppose it could be highlighted, something like "must meet the requirements of Compare, including the strict weak ordering requirement", but then it sounds like there are cases where the ordering is not included. Maybe a concise bad example would be worth adding. | ||
+ | : As for stable_sort, the actual requirement uses the word of power [http://eel.is/c++draft/alg.sorting#3.sentence-3 "shall"]], so it's undefined to violate that for both sort and stable_sort. --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 11:12, 9 April 2019 (PDT) | ||
+ | |||
+ | :: Indeed, I've been reading the standards and discovering these things. I'd had this assumption that stable_sort() was implementation-defined over poorly-ordered sequences, but it appears that it's actually undefined and could crash. In practice I think most implementations are a merge sort, which should have some reasonable behavior given input which isn't strict weak ordered. But the standard doesn't guarantee that, sadly. | ||
+ | |||
+ | :: The phrasing in the standard is: ''For algorithms other than those described in alg.binary.search, comp shall induce a strict weak ordering on the values.'' | ||
+ | |||
+ | :: I'd missed that the Compare requirement encoded the strict weak ordering requirement - that's pretty subtle. I do think that for all of the sort functions, it'd be nice to expand the compare bullet point, something like: | ||
+ | :: * Compare must meet the requirements of Compare, including the strict weak ordering requirement. If it doesn't the behavior of X_sort is undefined. | ||
+ | :: A bad example using floating point could be a good way to call out UB with floating point collections, since that's a serious gotcha. | ||
+ | |||
+ | :: I find it also an interesting question what the behavior of lower_bound and friends is if passed a sequence that is not partitioned with respect to the value being searched for. The standard does not use the word "shall" - it says: ''All of the algorithms in this subclause are versions of binary search and assume that the sequence being searched is partitioned with respect to an expression formed by binding the search key to an argument of the comparison function.'' What is your interpretation of the result if the sequence is not partitioned - undefined behavior, or implementation defined? | ||
+ | ::: "implementation-defined" is an additional standard requirement, not made here. I would say "undefined". If you feel strongly enough about it, consider [https://github.com/cplusplus/draft/issues raising an editorial issue] on whether 'assume' in [alg.binary.search]/1 means the same as 'shall' in [alg.sorting]/3, and what does it mean to violate it (ill-formed? undefined? unspecified?) --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 06:54, 10 April 2019 (PDT) | ||
+ | |||
+ | :: Also, if I comment on [Talk:Main_Page/suggestions] enough, will I gain edit access? --[[User:Sethml|SethML]] ([[User talk:Sethml|talk]]) 12:11, 9 April 2019 (PDT) | ||
+ | |||
+ | |||
+ | == Definintion of synchronizes-with in cpp/atomic/memory order? == | ||
+ | |||
+ | The page cpp/atomic/memory order tries to be fairly formal with defining the different types of memory ordering constraints, but a definition for "synchronizes-with" (which "inter-thread happens-before" depends on) appears to be missing. | ||
+ | |||
+ | == more copy & pastable header == | ||
+ | |||
+ | On all the pages at the top it says "Defined in <X>". I think it would be better to do "#include <X>" instead so I can copy & paste that into my code directly. | ||
+ | |||
+ | [[Special:Contributions/135.23.100.188|135.23.100.188]] 12:00, 21 April 2019 (PDT)Ben | ||
+ | |||
+ | == search widget takes me to wrong page when searching for restrict == | ||
+ | |||
+ | Entering "restrict" into the search widget at the top of the page, takes you to | ||
+ | https://en.cppreference.com/w/cpp/memory/gc/get_pointer_safety | ||
+ | rather than | ||
+ | https://en.cppreference.com/w/c/language/restrict | ||
+ | |||
+ | == Not all error_codes are platform-dependent == | ||
+ | |||
+ | In https://en.cppreference.com/w/cpp/error error_condition and error_error are described as: | ||
+ | |||
+ | error_condition (C++11) holds a portable error code | ||
+ | |||
+ | error_code (C++11) holds a platform-dependent error code | ||
+ | |||
+ | But that doesn't seem to be correct. See for example https://akrzemi1.wordpress.com/2017/07/12/your-own-error-code/#comment-6921 or http://blog.think-async.com/2010/04/system-error-support-in-c0x-part-2.html | ||
+ | :The descriptions are from overviews in the standard, see [http://eel.is/c++draft/syserr.errcode.overview syserr.errcode.overview] and [http://eel.is/c++draft/syserr.errcode.overview syserr.errcode.overview]. If you want to add something about the actual usage, I think we can add a "Notes" section to describe it. (By the way, the second article was written before C++11 so I doubt whether it is useful now.) --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 07:45, 27 April 2019 (PDT) | ||
+ | |||
+ | == open source libs == | ||
+ | How to add reference to open source lib? ([[User:Alex25|Alex25]] ([[User talk:Alex25|talk]]) 01:20, 28 April 2019 (PDT)) | ||
+ | |||
+ | == Improving this site == | ||
+ | |||
+ | I'm hardly a new user... can't I get edit rights (back)? [[User:CarloWood|CarloWood]] ([[User talk:CarloWood|talk]]) 09:18, 28 April 2019 (PDT) | ||
+ | |||
+ | == BNFLite == | ||
+ | |||
+ | Could you add nice BNFLite parsing h-library ( https://github.com/r35382/bnflite) into Text::Parse section | ||
+ | |||
+ | == Language support page: list library support with the library name not the compiler name == | ||
+ | |||
+ | The language support page lists compiler names in the list of library features. In a lot of Linux distributions, Clang will by default use GCC's libstdc++ instead of LLVM's libc++, which means that the relevant column to look at in that table for support when using Clang is the GCC column, not the Clang column. Likewise, clang-cl will use MSVC's standard library by default. (I think Intel's compiler behaves similarly to Clang in this regard, and indeed probably several other compilers in the table are not coupled to a particular standard library implementation.) | ||
+ | |||
+ | The current table structure seems less helpful than it could be. | ||
+ | |||
+ | Suggestion: rename the GCC column to libstdc++ and the Clang column to libc++; remove the columns for compilers that don't have their own standard library implementation; add introductory text explaining which standard library each compiler uses by default. | ||
+ | |||
+ | [[User:Zygoloid|zygoloid]] ([[User talk:Zygoloid|talk]]) 17:12, 4 May 2019 (PDT) | ||
+ | |||
+ | : this has been suggested as far back as 2016 [[Talk:cpp/compiler_support#Splitting_and_folding the_table]] and I don't think there is any opposition. Someone just needs to volunteer. --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 06:08, 6 May 2019 (PDT) | ||
+ | |||
+ | : Now I have placed core language features and library features into different tables, and renamed the columns when listing library features. However I think the introductory might be a hard work, since the compilers' default usage of standard library implementation is not well-documented. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 21:54, 6 May 2019 (PDT) | ||
+ | |||
+ | == Equivalence of the signature of function objects == | ||
+ | |||
+ | Hi, | ||
+ | |||
+ | the documentation of (e.g.) std::accumulate says: | ||
+ | |||
+ | op The signature of the function should be equivalent to the following: | ||
+ | |||
+ | Ret fun(const Type1 &a, const Type2 &b); | ||
+ | |||
+ | The signature does not need to have const &. | ||
+ | |||
+ | When is a signature "equivalent" to the above? [[Special:Contributions/2001:B01:2404:4:0:0:0:57|2001:B01:2404:4:0:0:0:57]] 23:49, 9 May 2019 (PDT) | ||
+ | :This is handwaving vigorously. The basic requirement is that a set of expressions must work. But of course that's a bit abstract and we want to show what a function (object) that meets the requirement should look like. Hence the weasel-wording. Perhaps we should rephrase the requirements in terms of the required expressions, and then show sample signatures as examples? [[User:T. Canens|T. Canens]] ([[User talk:T. Canens|talk]]) 20:23, 17 May 2019 (PDT) | ||
+ | |||
+ | == operator :: – ( I cannot edit https://en.cppreference.com/w/Talk:cpp/language/operator_precedence where it belongs to) == | ||
+ | |||
+ | At https://en.cppreference.com/w/cpp/language/operator_precedence the token <code>::</code> that is used to build nested names is listed as an "operator". But AFAIK this token is ''not'' an operator (or a very special one). | ||
+ | |||
+ | Because for ''any'' (binary) operator ★ the term <code>A★B★C</code> either means <code>(A★B)★C</code> _or_ <code>A★(B★C)</code> and you might add (…) to change the meaning. | ||
+ | |||
+ | But for :: you ''can't'' do this, because <code>A::(B::C)</code> '''does not compile''', and <code>(A::B)::C</code> compiles, but is parsed as a type cast of <code>::C</code> into the type <code>A::B</code>. :-/ | ||
+ | |||
+ | What do you think? Should it be changed or at least mentioned? --[[User:Roker|Roker]] ([[User talk:Roker|talk]]) 04:01, 13 May 2019 (PDT) | ||
+ | |||
+ | : the whole table is a loose approximation of expression grammar in human-readable terms of "precedence" and "associativity". These terms do not appear anywhere in the language specification, they are invented by the authors of the table. In the expression grammar, :: combines identifiers into primary expressions, so inasmuch as the grammar can be expressed in those terms, it has the "highest precedence". We could drop it, but then people used to seeing precedence tables from other sources such as [[enwiki:Operators_in_C_and_C%2B%2B#Operator_precedence]] would say cppreference's table is incomplete and add it back. --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 06:40, 13 May 2019 (PDT) | ||
+ | |||
+ | :: They can already say that since cppreference's table does not include const_cast et al, though. | ||
+ | :: OTOH, the standard calls :: an operator in [http://eel.is/c++draft/over.oper#3 [over.oper]/3]. --[[User:D41D8CD98F|D41D8CD98F]] ([[User talk:D41D8CD98F|talk]]) 11:06, 14 May 2019 (PDT) | ||
+ | |||
+ | == Add reference to paragraph about automatically generated class member functions == | ||
+ | |||
+ | Hi there. | ||
+ | |||
+ | In https://en.cppreference.com/w/cpp/language/classes, I suggest in the last paragraph we add references to the [https://en.cppreference.com/w/cpp/language/rule_of_three rule of zero/three/five]. | ||
+ | |||
+ | The very last sentence says: | ||
+ | |||
+ | ''"Some member functions are special: under certain circumstances they are defined by the compiler even if not defined by the user."'' | ||
+ | |||
+ | This would be an optimal place to refer to the rule of zero/three/five (link: https://en.cppreference.com/w/cpp/language/rule_of_three). | ||
+ | |||
+ | [[Special:Contributions/217.10.52.10|217.10.52.10]] 05:02, 13 May 2019 (PDT) | ||
+ | André Malcher | ||
+ | |||
+ | == Help to translate == | ||
+ | |||
+ | Eu gostaria de ajudar a traduzir as páginas para o português do Brasil, por que tem grande diferenças do de Portugal. | ||
+ | |||
+ | Gostaria de saber como posso fazer isso? | ||
+ | |||
+ | == Add argument types in the examples == | ||
+ | |||
+ | https://en.cppreference.com/w/cpp/io/c/fprintf | ||
+ | |||
+ | Stupidly enough, despite the extensive examples, there is none using the argument types (e.g. %lu) | ||
+ | |||
+ | == Add AI TP\O CURR[http://www.example.com link title] == | ||
+ | |||
+ | https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai[https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai] | ||
+ | |||
+ | == Add AI libraries for c++. == | ||
+ | |||
+ | https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai[https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai] | ||
+ | |||
+ | == AI using C++... == | ||
+ | |||
+ | |||
+ | [ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai] is the source of the following. I have inserted links to the libraries web sites. | ||
+ | You don't need a powerful language for programming AI. Most of the developers are using libraries like Keras,[keras.io] Torch [torch.ch], Caffe,[caffe.berkeleyvision.org] Watson [cloud.ibm.com/developer/watson/dashboard], TensorFlow,[www.tensorflow.org] etc. Those libraries are highly optimized and handle all the though work, they are built with high performance languages, like C. Python is just there to describe the neural network layers, load data, launch the processing and display results. Using C++ instead would give barely no performance improvement, but would be harder for non-developers as it require to care for memory management. Also, several AI people may not have a very solid programming or computer science background. | ||
+ | |||
+ | Another similar example would be game development, where the engine is coded in C/C++, and, often, all the game logic scripted in a high level language. | ||
+ | [[User:Iajzenszmi|Ian Martin Ajzenszmidt]] ([[User talk:Iajzenszmi|talk]]) 05:39, 18 May 2019 (PDT) | ||
+ | |||
+ | == Add See also: reference to <iomanip> from std::string? == | ||
+ | |||
+ | Just a stray thought for improved navigation. For new C++ users that find themselves at [std::basic_string](https://en.cppreference.com/w/cpp/string/basic_string) and the next place many would need to go a majority of the time would be to <iomanip>. Would it be worth adding a ***See Also:*** reference to <iomanip>. Especially for those who do not yet know <iomanip> exists. [[User:Drankinatty|Drankinatty]] ([[User talk:Drankinatty|talk]]) 18:26, 18 May 2019 (PDT) | ||
+ | |||
+ | == cpp/language/operator_comparison == | ||
+ | |||
+ | first sentence of the the section Notes currently is: | ||
+ | |||
+ | Because these operators group left-to-right, the expression {{c|a<b<c}} is parsed {{c|(a<b)<c}}, and not {{c|a<(b<c)}} or {{c|(a<b)&&(b<c)}}. | ||
+ | |||
+ | but the following would be clearer to understand: | ||
+ | |||
+ | Because these operators group left-to-right, the expression {{c|a<b<c}} is parsed {{c|(a<b)<c}}, and neither {{c|a<(b<c)}} nor {{c|(a<b)&&(b<c)}}. | ||
+ | |||
+ | == where can be donations be sent? == | ||
+ | |||
+ | Hello ! I read about the donations, can you give me please more informations about whre can the donations be made? it will be very usefull. Thanks ! | ||
+ | Sorry for disturbing the discussion page -[[User:Giani|Giani]] | ||
+ | |||
+ | == contradiction in definition of std::filesystem::weakly_canonical == | ||
+ | |||
+ | In the description of std::filesystem::weakly_canonical, it is stated that the parameter p must be an existing path. This is in contradiction with the description of the function std::filesystem::weakly_canonical, that states that p can consist of an existent left-hand-side and a non-existent right-hand-side. | ||
+ | |||
+ | == Parallelism TS 2 == | ||
+ | |||
+ | * https://en.cppreference.com/w/cpp/experimental/simd needs to be linked from https://en.cppreference.com/w/cpp/experimental/parallelism_2. | ||
+ | * https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/simd/abi_for_size needs to be renamed (as happend in the WD before the TS was published) to simd_abi::deduce. | ||
+ | * Most of the simd documentation needs to either be updated to TS state or written. | ||
+ | * I could help (author of that part of the TS). | ||
+ | |||
+ | [[User:Vir|Vir]] ([[User talk:Vir|talk]]) 03:12, 27 May 2019 (PDT) | ||
+ | :First two bullets are done. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) | ||
+ | |||
+ | == suggestion for the Private Inheritance section == | ||
+ | |||
+ | this sentence is hard to read: | ||
+ | ''' | ||
+ | Using a member offers better encapsulation and is generally preferred unless the derived class | ||
+ | requires access to protected members (including constructors) of the base, needs to override a | ||
+ | virtual member of the base, needs the base to be constructed before and destructed after some | ||
+ | other base subobject, needs to share a virtual base or needs to control the construction of a | ||
+ | virtual base. | ||
+ | ''' | ||
+ | |||
+ | this is much easier, using a list: | ||
+ | |||
+ | ''' | ||
+ | Using a member offers better encapsulation and is generally preferred unless the derived class: | ||
+ | --requires access to protected members (including constructors) of the base | ||
+ | --needs to override a virtual member of the base | ||
+ | --needs the base to be constructed before and destructed after some other base subobject | ||
+ | --needs to share a virtual base or needs to control the construction of a virtual base | ||
+ | ''' | ||
+ | [[Special:Contributions/75.142.108.70|75.142.108.70]] 14:01, 2 June 2019 (PDT) | ||
+ | |||
+ | == Suggested addition for std::time page == | ||
+ | |||
+ | Please add links to the following pages in the "See also" section of https://en.cppreference.com/w/cpp/chrono/c/time | ||
+ | |||
+ | https://en.cppreference.com/w/cpp/chrono/c/asctime | ||
+ | https://en.cppreference.com/w/cpp/chrono/c/strftime | ||
+ | |||
+ | [[Special:Contributions/139.181.7.34|139.181.7.34]] 16:30, 4 June 2019 (PDT) | ||
+ | |||
+ | == the headline for the non-throwing deletes is incorrect == | ||
+ | |||
+ | functions 9-12 are headlined as placement versions, whereas they are non-throwing versions. | ||
+ | |||
+ | : new(nothrow) is placement-new by [http://eel.is/c++draft/expr.new#15 expr.new/15] --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 05:07, 6 June 2019 (PDT) | ||
+ | : now I see, [[cpp/memory/new/operator_new]] calls them "replaceable non-throwing", while [[cpp/memory/new/operator_delete]] calls them "replaceable placement".. Perhaps "non-throwing" is more user-friendly even if all of them are actually non-throwing --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 06:41, 6 June 2019 (PDT) | ||
+ | |||
+ | == Only for multidimensional arrays? == | ||
+ | |||
+ | I think the description should read "(potentially multidimensional) array" instead of "multidimensional array". | ||
+ | |||
+ | == Can a standard exception object embed a fixed-size array? == | ||
+ | |||
+ | The documentation for e.g. std::runtime_error, at | ||
+ | |||
+ | <https://en.cppreference.com/w/cpp/error/runtime_error>, | ||
+ | |||
+ | states: | ||
+ | |||
+ | "Because copying std::runtime_error is not permitted to throw exceptions, | ||
+ | this message is typically stored internally as a separately-allocated | ||
+ | reference-counted string." | ||
+ | |||
+ | Would it be OK to store the message into an array data member? That means that the string could have to be truncated, so the question is whether having a maximum length falls under possible implementation-defined limits. [[Special:Contributions/37.182.205.198|37.182.205.198]] 03:06, 13 June 2019 (PDT) | ||
+ | :The string cannot be truncated because of [http://eel.is/c++draft/runtime.error the post-condition]. Though I think that constructors of {{tt|std::runtime_error}} taking {{tt|const char*}} and {{tt|const std::string&}} are still permitted to throw exception if the string is too long, and an array of {{tt|char}} embedded in the exception object is also permitted --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 03:55, 13 June 2019 (PDT) | ||
+ | |||
+ | == std::size_t error in example == | ||
+ | |||
+ | Reverse iteration. Unsigned variable taking values lower than 0. | ||
+ | |||
+ | for (std::size_t i = a.size()-1; '''i < a.size()'''; --i) | ||
+ | |||
+ | Should be: | ||
+ | |||
+ | for (std::size_t i = a.size()-1; '''i >= 0'''; --i) | ||
+ | |||
+ | :{{lc|std::size_t}} is an unsigned integer type, so {{tt|1=i >= 0}} always holds and the loop you suggested is endless. On the other hand, if {{tt|1=i == 0}} then {{tt|--i}} make {{tt|i}} equals to the maximum value of {{tt|std::size_t}} which is almost always larger than {{tt|a.size()}}, so the loop will reach its end. If you don't like this, something like {{c|1=for (std::size_t i = a.size(); i != 0;) { --i;/*...*/} }} might be useful. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 04:56, 21 June 2019 (PDT) | ||
+ | |||
+ | == Typo on std::iterator page == | ||
+ | |||
+ | Hi, | ||
+ | |||
+ | In the example section of the std::iterator page it says '.. _a_ input iterator ..' which should be '.. _an_ input iterator ..'. | ||
+ | |||
+ | Thanks for the truly excellent resource that is cppreference. | ||
+ | |||
+ | Best regards, | ||
+ | |||
+ | Kris van Rens | ||
+ | [[Special:Contributions/5.132.118.36|5.132.118.36]] 13:44, 22 June 2019 (PDT) | ||
+ | |||
+ | == Enum syntax: trailing semicolon == | ||
+ | |||
+ | It appears that on the enum declaration page, a trailing semicolon is missing at various places for the enum declarations. | ||
+ | |||
+ | == cpp/utility/functional/bind/example == | ||
+ | |||
+ | the following line is wrong: | ||
+ | f1(1, 2, 1001); // 1 is bound by _1, 2 is bound by _2, 1001 is unused | ||
+ | and it should be: | ||
+ | f1(1, 2, 1001); // 1 is bound by _2, 2 is bound by _1, 1001 is unused | ||
+ | [[User:Rob42|Rob42]] ([[User talk:Rob42|talk]]) 07:55, 9 July 2019 (PDT) | ||
+ | |||
+ | : I believe the comment is correct as is, but given [https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/bind&diff=66046&oldid=66045], [https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/bind&diff=77501&oldid=72012], [https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/bind&diff=94085&oldid=93599], [https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/bind&diff=106904&oldid=103200] (all of them are wrong edits to the example) this line seems to have confused a lot of readers. I've edited the example in the hope to make it harder to misunderstand. --[[User:D41D8CD98F|D41D8CD98F]] ([[User talk:D41D8CD98F|talk]]) 10:26, 9 July 2019 (PDT) | ||
+ | |||
+ | == Replace dead link in rule of three page with archive.org link == | ||
+ | |||
+ | The link to the original source for the "rule of zero" on the page https://en.cppreference.com/w/cpp/language/rule_of_three is dead. | ||
+ | |||
+ | Perhaps change https://rmf.io/cxx11/rule-of-zero to https://web.archive.org/web/20160602100235/https://rmf.io/cxx11/rule-of-zero/ | ||
+ | |||
+ | [[Special:Contributions/73.8.19.235|73.8.19.235]] 09:19, 10 July 2019 (PDT)joe | ||
+ | |||
+ | == errno and strto* examples == | ||
+ | |||
+ | On some examples, like strtol, errno is not reset before calling the function and is checked after an intermediate call to other functions, such as printf, which can set errno itself. | ||
+ | |||
+ | Although it is not relevant for the correct execution of the example, IMHO those code snippets should be a vehicle for promoting good practices. So I suggest to clear errno before calling strto* and test (or save) it immediately after the call. | ||
+ | |||
+ | [[Special:Contributions/79.151.6.162|79.151.6.162]] 10:19, 11 July 2019 (PDT)oscarfv | ||
+ | |||
+ | == Subsume is synonym for implies. == | ||
+ | On TS variant of concepts at: | ||
+ | https://en.cppreference.com/w/cpp/experimental/constraints | ||
+ | |||
+ | You have inconsistency in your definitions/use of the word ''subsumes''. Subsumes is synonym for implies by your first definition. (and also by C++20 standard version of concept https://en.cppreference.com/w/cpp/language/constraints) | ||
+ | |||
+ | |||
+ | 1) "Concept {{tt|P}} is said to ''subsume'' concept {{tt|Q}} if it can be proven that {{tt|P}} [[enwiki:Logical consequence|implies]] {{tt|Q}}" | ||
+ | |||
+ | 2) "{{tt|A}} subsumes a conjunction {{tt|A&&B}} and does not subsume a disjunction {{tt|A{{!!}}B}}" | ||
+ | |||
+ | But | ||
+ | |||
+ | Mathematically in truth/boolean logic this is tautology for conjunction (always true): | ||
+ | {{tt|A&&B}} implies {{tt|A}} | ||
+ | |||
+ | and also always | ||
+ | |||
+ | {{tt|A&&B}} implies {{tt|B}} | ||
+ | |||
+ | so by first definition of word 'subsume' the second statement above should be other way around | ||
+ | |||
+ | {{tt|A&&B}} subsumes {{tt|A}} | ||
+ | |||
+ | and also mathematically for disjunction (boolean logic): | ||
+ | {{tt|A}} implies {{tt|A{{!!}}B}} | ||
+ | |||
+ | and also | ||
+ | {{tt|B}} implies {{tt|A{{!!}}B}} | ||
+ | |||
+ | Now replace word implies for subsumes in those statements | ||
+ | and you get contradiction again to your second statement 2). | ||
+ | |||
+ | Also note: | ||
+ | |||
+ | {{tt|A{{!!}}B}} does not imply {{tt|A}} | ||
+ | {{tt|A{{!!}}B}} does not imply {{tt|B}} | ||
+ | |||
+ | so again does not subsume. | ||
+ | |||
+ | On another note: | ||
+ | You derive class to model 'is-a' relationship or subset relationship. | ||
+ | You narrow down original big class of animals. | ||
+ | |||
+ | class Cat:Animal | ||
+ | {} | ||
+ | |||
+ | Cat is an animal. Set of cats is subset of set of all animals. | ||
+ | |||
+ | Or you have implication "x is a cat implies x is an animal" , but not otherway around 'x is animal' does not imply 'x is a cat'. | ||
+ | In concept language: | ||
+ | Cat is additional constraint on top of animal. (Moveable and meowavle) and additional constraint | ||
+ | makes class smaller subset and smaller subset means. | ||
+ | So you either say Animal set subsumes Cats sub-set. | ||
+ | Or you use 'subsume' for the characteristics (like in concepts). | ||
+ | Cat characteristic subsumes Animal characteristics (x is a cat assumes/implies/subsumes x is a living being). | ||
+ | |||
+ | == @ sign is displayed in place of overloaded operators == | ||
+ | |||
+ | Sorry about the previous message, I accidentally posted an edited page instead of the suggestion. | ||
+ | |||
+ | Edit suggestion: | ||
+ | @ sign is being displayed instead of operators !, << and ++ in Overloaded Operators section. | ||
+ | |||
+ | == overload resolution links in using-declaration == | ||
+ | |||
+ | In the inheriting constructors section of the {{ltt|cpp/language/using_declaration}} it would be great to add a link when {{ltt|cpp/language/overload_resolution|overload resolution}} is mentioned. | ||
+ | |||
+ | == unique_ptr better example == | ||
+ | |||
+ | Hi! I think this example will be helpful on `std::unique_ptr` page. Somehow, I always struggle to remember that usage. | ||
+ | |||
+ | struct MyDeleter { | ||
+ | void operator ()(int *val) { | ||
+ | delete[] val; | ||
+ | } | ||
+ | }; | ||
+ | typedef std::unique_ptr<int, MyDeleter> my_ptr; | ||
+ | int main(int, char**) | ||
+ | { | ||
+ | my_ptr x(new int[10]); | ||
+ | } | ||
+ | |||
+ | :I think it would be better to using {{c|std::unique_ptr<int[]>}}. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 20:18, 26 July 2019 (PDT) | ||
+ | |||
+ | == Strong ordering does not allow equivalence == | ||
+ | |||
+ | I believe https://en.cppreference.com/w/cpp/utility/compare/strong_ordering is incorrect in listing "equivalent" as one of the possible values. [[User:Gio|Gio]] ([[User talk:Gio|talk]]) 19:57, 28 July 2019 (PDT) | ||
+ | :[http://eel.is/c++draft/cmp.strongord It allows]. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 01:53, 29 July 2019 (PDT) | ||
+ | ::Right, thank you. But, then, shouldn't at least the descriptions for "equal" and "equivalent" be different? [[User:Gio|Gio]] ([[User talk:Gio|talk]]) 12:55, 29 July 2019 (PDT) | ||
+ | :::But they aren't different in this case. [http://eel.is/c++draft/cmp.categories#pre-1 equivalent {{=}} equal] --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 13:45, 29 July 2019 (PDT) | ||
+ | |||
+ | == final specifier example typo == | ||
+ | |||
+ | A::foo() comment should be fixed to: | ||
+ | // Base::foo is overridden and it is the final override | ||
+ | |||
+ | [[User:Zhesson|Zhesson]] ([[User talk:Zhesson|talk]]) 09:27, 30 July 2019 (PDT) | ||
+ | :Fixed. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 03:23, 31 July 2019 (PDT) | ||
+ | |||
+ | == FLT_MAX_EXP definition typo in climits == | ||
+ | |||
+ | [[cpp/types/climits|The current definition]] | ||
+ | |||
+ | {{dsc begin}} | ||
+ | {{dsc macro const | FLT_MAX_EXP<br>DBL_MAX_EXP<br>LDBL_MAX_EXP | maximum positive integer such that {{tt|FLT_RADIX}} raised by power one more than that integer is a normalized {{c|float}}, {{c|double}} and {{c|long double}} respectively | nolink=true }} | ||
+ | {{dsc end}} | ||
+ | |||
+ | This is incorrect; [[c/types/limits|the similar page for C]] has the correct definition: | ||
+ | |||
+ | maximum positive integer such that FLT_RADIX raised by power '''one less''' than that integer is a normalized... | ||
+ | :Fixed. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 03:23, 31 July 2019 (PDT) | ||
+ | |||
+ | == Unqualified name lookup->Class definition == | ||
+ | |||
+ | I think a, c is incorrect because of class scope and his accessing rules - all names defined in class is available in entire class even if declaration is put below instruction of use. | ||
+ | |||
+ | d - if class is nested into another class then entire outer class will be searching and if name will still not found then local scope until definition class - because function accessing rules. | ||
+ | |||
+ | : the rules you're describing are a little lower, in [[cpp/language/unqualified_lookup#Member_function_definition]] --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 08:23, 2 August 2019 (PDT) | ||
+ | |||
+ | == std::basic_fstream<CharT,Traits>::swap Example == | ||
+ | {{anchor|basic_fstream_swap_Example}} | ||
+ | https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_fstream/swap&oldid=50835 | ||
+ | Example: | ||
+ | |||
+ | <source> | ||
+ | bool Create(string path, fstream & fs) { | ||
+ | try { | ||
+ | fstream fst(path, ios::binary | ios::trunc | ios::in | ios::out); | ||
+ | if (!fst.is_open()) | ||
+ | return false; | ||
+ | fst.swap(fs); | ||
+ | return true; | ||
+ | } | ||
+ | catch (...) { | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | use | ||
+ | |||
+ | <source> | ||
+ | int main(void) { | ||
+ | fstream fs; | ||
+ | string path = "E:\\Downloads\\x125\\Cpp11.pdf"; | ||
+ | if(File::Create(path, fs)) | ||
+ | fs.write(path.c_str(), path.length()); | ||
+ | return 0; | ||
+ | } | ||
+ | </source> | ||
+ | {{unsigned|Rsarov|08:29, 2 August 2019 (PDT)}} | ||
+ | : {{mark_ok}} Copied (with modifications) to [[cpp/io/basic_fstream/swap#Example|fstream/swap page]].--[[User:Space Mission|Space Mission]] ([[User talk:Space Mission|talk]]) 08:13, 16 June 2021 (PDT) | ||
+ | |||
+ | == Concepts: PascalCase --> standard_case == | ||
+ | |||
+ | |||
+ | Perhaps add a note about P1754 R0: | ||
+ | http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1754r0.pdf | ||
+ | |||
+ | : r1. And I think we're waiting for it to be actually merged into the draft (it's [https://github.com/cplusplus/draft/pull/3099 PR 3099] --[[User:Cubbi|Cubbi]] ([[User talk:Cubbi|talk]]) 05:04, 5 August 2019 (PDT) | ||
+ | |||
+ | == main() is indented 4 spaces. Unlike the rest. Please make that 2 spaces. == | ||
+ | |||
+ | main() is indented 4 spaces. Unlike the rest. Please make that 2 spaces. | ||
+ | |||
+ | PS Can't I get edit rights? I'm not vandalizing, so... | ||
+ | |||
+ | == C fwrite missing error behaviour regarding file position. == | ||
+ | |||
+ | If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. | ||
+ | |||
+ | [[Special:Contributions/13.236.57.85|13.236.57.85]] 01:41, 6 August 2019 (PDT) | ||
+ | |||
+ | == inconsistent find/rfind description == | ||
+ | |||
+ | I don't think "find characters" is good wording for find on the main page of basic_string, should be "find substring" (or "find character sequence" as it's put in https://en.cppreference.com/w/cpp/string/basic_string/find) in order to avoid confusion with find_first_of. Also find/rfind titles should be consistent imo, "find the first/last occurrence of a substring" seems to be a good fit | ||
+ | |||
+ | https://en.cppreference.com/w/cpp/string/basic_string | ||
+ | |||
+ | find: "find characters in the string" | ||
+ | rfind: "find the last occurrence of a substring" | ||
+ | |||
+ | [[Special:Contributions/180.183.72.126|180.183.72.126]] 22:38, 6 August 2019 (PDT) | ||
+ | Vitaly | ||
+ | |||
+ | == Memory leak in example on https://en.cppreference.com/w/cpp/locale/numpunct == | ||
+ | |||
+ | I think the "new french_bool" in the example of https://en.cppreference.com/w/cpp/locale/numpunct leads to a memory leak so I would suggest to use a locale variable which can be freed at the end. | ||
+ | |||
+ | Best regards | ||
+ | Stefan | ||
+ | |||
+ | [[Special:Contributions/195.242.227.17|195.242.227.17]] 03:07, 7 August 2019 (PDT) | ||
+ | :Please read [[cpp/locale/locale/locale#Notes|this note]]. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 03:50, 7 August 2019 (PDT) | ||
+ | |||
+ | == Duplication for feature testing macros == | ||
+ | |||
+ | The table [[cpp/preprocessor/replace#Language_feature-testing_macros]] duplicates [[cpp/feature_test#Language_features]] (with less information). It should be replaced by a link, e.g.: | ||
+ | |||
+ | {{rrev|since=c++20|The standard further defines a set of [[cpp/feature test|feature testing]] preprocessor macros corresponding to C++ language and library features introduced in C++11 or later. | ||
+ | }} | ||
+ | [[User:Ecatmur1|Ecatmur1]] ([[User talk:Ecatmur1|talk]]) 04:17, 7 August 2019 (PDT) | ||
+ | |||
+ | == Template:cpp/container/lower bound == | ||
+ | |||
+ | Add "(i.e. greater or equal to)" after "that is ''not less'' than" (like the text on [[cpp/algorithm/lower bound]]). | ||
+ | |||
+ | == tuple page's forward_as_tuple description not accurate == | ||
+ | |||
+ | "forward_as_tuple creates a tuple of rvalue references " | ||
+ | |||
+ | It should be forwarding references rather than rvalue references | ||
+ | :Fixed. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 08:42, 7 August 2019 (PDT) | ||
+ | |||
+ | == error in the example code for std::filesystem::create_directory == | ||
+ | |||
+ | The line fs::permissions("sandbox/1/2/b", fs::perms::remove_perms | fs::perms::others_all); | ||
+ | does not compile. | ||
+ | |||
+ | It should rather be | ||
+ | |||
+ | fs::permissions("sandbox/1/2/b", fs::perms::others_all, fs::perm_options::remove); | ||
+ | |||
+ | [[User:Yimyom|- David Bellot]] ([[User talk:Yimyom|talk]]) 16:15, 7 August 2019 (PDT) | ||
+ | :Fixed. --[[User:Fruderica|Fruderica]] ([[User talk:Fruderica|talk]]) 04:05, 8 August 2019 (PDT) | ||
+ | |||
+ | == Complexity of set algorithms == | ||
+ | |||
+ | The complexity of all set operations ({{c|std::includes}}, {{c|std::set_difference}}, etc) is listed as follows: | ||
+ | |||
+ | <blockquote> | ||
+ | At most {{math|2·(N<sub>1</sub>+N<sub>2</sub>-1)}} comparisons, where {{math|N<sub>1</sub>}} {{c|{{=}} std::distance(first1, last1)}} and {{math|N<sub>2</sub>}} {{c|{{=}} std::distance(first2, last2)}} | ||
+ | </blockquote> | ||
+ | |||
+ | This is different from the [http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/n4778.pdf text in the standard] (§ 23.7.6.1), which states: | ||
+ | |||
+ | <blockquote> | ||
+ | Complexity: At most {{c|2 * ((last1 - first1) + (last2 - first2)) - 1}} comparisons. | ||
+ | </blockquote> | ||
+ | |||
+ | The equation should be changed to {{math|2·(N<sub>1</sub>+N<sub>2</sub>)-1}} to match the standard. | ||
+ | |||
+ | [[User:Rbrown46|Ryan Brown]] ([[User talk:Rbrown46|talk]]) 12:59, 9 August 2019 (PDT) | ||
+ | |||
+ | == Vertical propagation of allocators == | ||
+ | |||
+ | The vertical propagation allocators is documented very poorly. | ||
+ | |||
+ | The [[cpp/memory/scoped_allocator_adaptor|{{tt|std::std::scoped_allocator_adaptor<OuterAlloc, InnerAlloc...>}}]] documentation gives the impression that it can be used with any allocator, however, it miserably fails when used together with [[cpp/memory/polymorphic_allocator|{{tt|std::polymorphic_allocator<T>}}]] (see [1]). On the other hand, [[cpp/memory/polymorphic_allocator|{{tt|std::polymorphic_allocator<T>}}]] already has the capabilities to propagate the allocator vertically as noted in [1], however, this is only noted in the constructor of the allocator, so this is very easy to miss. | ||
+ | |||
+ | My concrete suggestion is: | ||
+ | * Add a note in the [[cpp/memory/scoped_allocator_adaptor|{{tt|std::std::scoped_allocator_adaptor<OuterAlloc, InnerAlloc...>}}]] saying that this is not needed when {{tt|OuterAlloc}} is a [[cpp/memory/polymorphic_allocator|{{tt|std::polymorphic_allocator<T>}}]]. | ||
+ | * Promote and clarify the note in [[cpp/memory/polymorphic_allocator/polymorphic_allocator|{{tt|std::polymorphic_allocator<T>::construct(...)}}]] to [[cpp/memory/polymorphic_allocator|{{tt|std::polymorphic_allocator<T>}}]] so that it is clear that child continer-like objects will have the same allocators as the parent. | ||
+ | |||
+ | [1]: https://stackoverflow.com/questions/54654606/c-cant-propagate-polymorphic-allocator-with-scoped-allocator-adaptor | ||
+ | |||
+ | [[Special:Contributions/129.206.107.164|129.206.107.164]] 09:57, 10 October 2023 (PDT) | ||
+ | sospinar |
Revision as of 12:14, 10 October 2023
This page collects edit suggestions from new and logged-out users when editing is temporarily disabled due to vandalism. Click the "+" at the top to leave a message. Please make sure to include a link to the page you are referencing. See /archive and /archive 1 for old suggestions that have been responded to.
noexcept specifier
The description of functions with an implicit non-throwing exception specifier is not complete. Implicitly declared constructors and assignment operators are omitted. Also comparison operators that are defaulted on their first declaration is omitted. Furthermore it unnecessarily lists categories of constructors and assignment operators.
- ✔ Done (more precise wording might be required) The categories is listed because they link to different pages. Fruderica (talk) 20:39, 21 April 2019 (PDT)
Expression SFINAE DR339 / N2634
I would like to add Expression SFINAE as a C++11 feature: N2634
Supported in: GCC 4.4, clang 2.9, MSVC: no/partial support. In particular, no support for decltype [temp.deduct]/7 up to 19.15. source
Rustyx (talk) 12:40, 22 February 2019 (PST)
- what's missing from its current description in cpp/language/sfinae#Expression_SFINAE? --Cubbi (talk) 12:46, 22 February 2019 (PST)
- I think Rustyx means to add a new row in cpp/compiler support. T. Canens (talk) 10:02, 23 February 2019 (PST)
- Indeed that's what I meant, cpp/compiler support. Can't post on that page, unfortunately. Rustyx (talk) 10:48, 24 February 2019 (PST)
- I think Rustyx means to add a new row in cpp/compiler support. T. Canens (talk) 10:02, 23 February 2019 (PST)
- Added (partially). I don't know whether IBM XL C++, Sun/Oracle C++ or HP aCC support expression SFINAE, or in which edition they began to support. If anyone knows, please improve it. --Fruderica (talk) 03:57, 25 April 2019 (PDT)
Permission for editing: Compiler support
I would like to add the Apple Clang/Xcode column to the compiler support page now. Thanks in advance for permissions.--Buovjaga (talk) 02:25, 23 February 2019 (PST)
- I don't think I have the technical ability to manually grant permissions. If you post the edits here, I can copy them over. (Although by the time you are done posting them here you may well have accumulated enough edits to get past the threshold...) T. Canens (talk) 10:00, 23 February 2019 (PST)
- I gave this a lot of thought, but I am afraid I cannot bring myself to do it. The work will require possibly creating multiple templates. I cannot reason about this in theory, I need to be able to see the effects of the templates live. Even if I could, I would essentially be writing a complex tutorial on doing the edits, which seems like a massive waste of effort. I will be waiting for the editing permissions. Buovjaga (talk) 05:49, 3 March 2019 (PST)
- After more thought, I will attempt to describe what should be done. I hope someone can pick this up. The goal is to create a new column named Apple Clang, perhaps after the existing Clang column. It would contain the Apple Clang version number and show the Xcode version number in a tooltip (hint). Steps below:
- Add the column to Template:compiler_support_row
and[[Template:compiler_support_top]]and the compiler name to Template:compiler support (edited by --Space Mission (talk) 05:01, 6 September 2023 (PDT))
- Add the column to Template:compiler_support_row
- After more thought, I will attempt to describe what should be done. I hope someone can pick this up. The goal is to create a new column named Apple Clang, perhaps after the existing Clang column. It would contain the Apple Clang version number and show the Xcode version number in a tooltip (hint). Steps below:
- I gave this a lot of thought, but I am afraid I cannot bring myself to do it. The work will require possibly creating multiple templates. I cannot reason about this in theory, I need to be able to see the effects of the templates live. Even if I could, I would essentially be writing a complex tutorial on doing the edits, which seems like a massive waste of effort. I will be waiting for the editing permissions. Buovjaga (talk) 05:49, 3 March 2019 (PST)
- A note from 2023: After recent updates to Template:compiler support there is no need to edit the (deprecated) templates [[Template:compiler support top]] and [[Template:compiler support bottom]]. If necessary, modify the compilers list directly in Template:compiler support (all in one place). So, I stroke out the second link above (also removing link-dependency). --Space Mission (talk) 05:01, 6 September 2023 (PDT)
- Possibly add a new template in the style of Template:msvc_ver. I don't know the best way to design it so it would accept the Apple Clang and Xcode versions.
- In the actual article, add "yes" entries for std::any, std::variant and std::optional with Apple Clang version 10.0.0 and Xcode version 10.0
- Add a "no" entry for std::filesystem
- Add to references: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions and https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
- --Buovjaga (talk) 05:37, 19 March 2019 (PDT)
new expression missing exception specs
Somewhere way down in that wall of text there is a mention of std::bad_array_new_length, but that's it. I think there should be a dedicated section "Exceptions" (as in other docs on this site) documenting std::bad_alloc and std::bad_array_new_length as well as the non-throwing versions, as this is pretty fundamental. Perhaps also an example.
Thanks! 213.68.42.195 03:02, 25 February 2019 (PST)
New user
Hello, I would like to make changes to the C++ compiler support page related to the addition of the "Modules" and "Coroutines" features to C++20. Can somebody give me permissions to edit or otherwise do the changes as per the following articles:
https://www.phoronix.com/scan.php?page=news_item&px=Coroutines-Modules-CPP20 https://herbsutter.com/2019/02/23/trip-report-winter-iso-c-standards-meeting-kona/
--Trifud (talk) 23:15, 26 February 2019 (PST)
- How long time does it take for a user to be activated? --Trifud (talk) 23:09, 28 February 2019 (PST)
RFC: another implementation of Gadget-StandardRevision
source code |
---|
(function() { 'use strict'; var styles = document.createElement('style'); styles.textContent = '[hidden] { display: none !important; }'; styles.textContent += '.stdrev-rev-hide > tbody > tr > td { border: none !important; padding: 0 !important; }' styles.textContent += '.stdrev-rev-hide > tbody > tr > td:nth-child(2) { display: none; }' styles.textContent += '.stdrev-rev-hide { border: none; }' styles.textContent += '.stdrev-rev-hide > span > .t-mark-rev { display: none; }' document.head.append(styles); var rev = mw.config.get('wgTitle').indexOf('c/') === 0 ? [ 'C89', 'C99', 'C11' ] : [ 'C++98', 'C++03', 'C++11', 'C++14', 'C++17', 'C++20' ]; var select = $('<div class="vectorMenu"></div>').appendTo('#cpp-head-tools-right'); select.append('<h5><span>Std rev</span></h5>'); var list = $('<ul>').appendTo($('<div class="menu">').appendTo(select)); $.each(['DIFF'].concat(rev), function(i, v) { list.append('<li><a href="#'+v+'">'+v+'</a></li>'); }); list.on('click', 'a', function(e) { list.find('a').css('font-weight', 'normal'); $(this).css('font-weight', 'bold'); curr_rev = e.target.innerText; on_rev_changed(); }); var curr_rev = 'DIFF'; // Returns true if an element should be shown in the current revision, that is, either curr_rev is // DIFF (i.e. show all), or curr_rev is within the range [since, until). The range [since, until) // is inspected from the classes of `el`. // `el` may be the same element as the one to be shown if it has the needed classes, or it may be a // revision marker or a collection thereof (e.g. one expanded from {{mark since foo}}, or from the // {{mark since foo}}{{mark until bar}} combo). // `el` may be either a HTML element or a jQuery object. // Note that this correctly handle the case when `el` represents an empty set of elements (in which // case the element is always shown). function should_be_shown(el) { if (curr_rev === 'DIFF') return true; var curr_revid = rev.indexOf(curr_rev); var since = 0, until = rev.length; $.each(rev, function(i) { var ssince = 't-since-'+rev[i].toLowerCase().replace(/\+/g, 'x'); var suntil = 't-until-'+rev[i].toLowerCase().replace(/\+/g, 'x'); if ($(el).hasClass(ssince)) since = i; if ($(el).hasClass(suntil)) until = i; }); return since <= curr_revid && curr_revid < until; } // Called when user changes the selected revision. Inside this function, curr_rev is already set to // the value after the change. function on_rev_changed() { handle_dcl(); renumber_dcl(); handle_dsc(); handle_nv(); handle_rev(); handle_headings(); handle_list_items(); $('.t-rev-begin, .t-rev-inl').toggleClass('stdrev-rev-hide', curr_rev !== 'DIFF'); $('.t-mark-rev').each(function() { this.hidden = curr_rev !== 'DIFF'; if ($(this.nextSibling).is('br')) this.nextSibling.hidden = curr_rev !== 'DIFF'; }); } // Returns true if the jQuery object `el` contains at least one element, and all contained elements // are hidden; otherwise returns false. // This is used to hide a 'parent' or 'heading' element when all its contents are hidden. function all_hidden(el) { return $(el).length > 0 && !$(el).is(':not([hidden])'); } // Hide or show the elements expanded from the {{dcl ...}} template family. See documentation at // https://en.cppreference.com/w/Template:dcl/doc . // The dcl items (expanded from {{dcl | ... }}) may either appear alone or as children of versioned // declaration list (expanded from {{dcl rev begin | ... }}). In the latter case, the revision may // be supplied by the dcl items or by the dcl-rev (in the latter case the dcl-rev has class // t-dcl-rev-notes). // For the use of renumber_dcl(), each dcl-rev is marked as hidden if all its children dcl items // are hidden, and vice versa. function handle_dcl() { $('.t-dcl').each(function() { this.hidden = !should_be_shown(this); }); $('.t-dcl-rev').each(function() { if ($(this).is('.t-dcl-rev-notes')) { var hidden = !should_be_shown(this); this.hidden = hidden; $(this).find('.t-dcl').each(function() { this.hidden = hidden; }); } else { this.hidden = all_hidden($(this).find('.t-dcl')); } }); $('.t-dcl-begin .t-dsc-header').each(function() { var marker = $(this).find('> td > div > .t-mark-rev'); var lastheader = $(this).nextUntil(':not(.t-dsc-header)').addBack(); var elts = lastheader.nextUntil('.t-dsc-header').filter('.t-dcl, .t-dcl-rev'); this.hidden = all_hidden(elts) || !should_be_shown(marker); }); $('.t-dcl-h').each(function() { this.hidden = all_hidden($(this).nextUntil(':not(.t-dcl, .t-dcl-rev)')); }); } // Ensure that each visible dcl item in a dcl list is contiguously numbered, and rewrite mentions // to these numbers to use the modified numbering. // If a list item (e.g. those expanded from @m@) contains no number after the rewrite (i.e. it's // inapplicable in current revision), it is hidden. // Note that the use of '~ * .t-li, ~ * .t-v' effectively establishes a kind of scoping: only // numbers that appear after the dcl list and are more nested in the DOM hierarchy are affected // by the renumbering. // Requires that handle_dcl() has been called. function renumber_dcl() { $('.t-dcl-begin').each(function() { var numbering_map = []; var i = 0; $(this).find('.t-dcl, .t-dcl-rev').each(function() { var num_cell; if ($(this).is('.t-dcl')) num_cell = $(this).children('td:nth-child(2)'); else num_cell = $(this).find('> tr.t-dcl-rev-aux > td:nth-child(2)'); var number_text = /\s*\((\d+)\)\s*/.exec(num_cell.text()); if (!num_cell.attr('data-orig-num') && number_text) num_cell.attr('data-orig-num', number_text[1]); var original_num = num_cell.attr('data-orig-num'); if (original_num) { if (! numbering_map[original_num]) numbering_map[original_num] = $(this).is('[hidden]') ? null : ++i; num_cell.text('('+numbering_map[original_num]+')'); } }); $(this).find('~ * .t-li, ~ * .t-v').each(function() { if (! $(this).attr('data-orig-v')) $(this).attr('data-orig-v', $(this).text().replace(/[()]/g, '')); var original_numbers = []; $.each($(this).attr('data-orig-v').split(','), function(i, v) { var match = /(\d+)(?:-(\d+))?/.exec(v); if (match[2]) for (var i = +match[1]; +i <= +match[2]; ++i) original_numbers.push(i); else original_numbers.push(match[1]); }); var numbers = $.map(original_numbers, function(x) { return numbering_map[x]; }); var s = []; for (var i = 0; i < numbers.length; ++i) { if (numbers[i+1] - numbers[i] === 1 && numbers[i+2] - numbers[i+1] === 1) { var begin = numbers[i]; while (numbers[i+1] - numbers[i] === 1) ++i; s.push(begin+'-'+numbers[i]); } else { s.push(numbers[i]); } } if ($(this).is('.t-li')) { this.parentElement.hidden = numbers.length === 0; $(this).text(s.join(',')+')'); } else $(this).text('('+s.join(',')+')'); }); }); } // Hide or show the elements expanded from the {{dsc ...}} template family. See documentation at // https://en.cppreference.com/w/Template:dcl/doc . // The revision markers are in the first cell of each dsc item. In the general case, the visibility // of a dsc item is control by a single revision marker. But if a specialized template is used, // and the amount of entity names in the first cell matches the lines of the revision markers, // then each line controls the visibility of a single entity name, and the dsc item is hidden only // if all the entity names are hidden. // If all the dsc items are hidden, then the corresponding headings are hidden as well. function handle_dsc() { $('.t-dsc').each(function() { var member = $(this).find('.t-dsc-member-div'); if (member[0]) { var lines = member.find('> div:nth-child(2) > .t-lines').children(); var mems = member.find('> div:first-child .t-lines').children(); if (lines.length !== mems.length) this.hidden = !should_be_shown(lines.children('.t-mark-rev')); else { lines.each(function(i) { var marker = $(this).children('.t-mark-rev'); mems[i].hidden = !should_be_shown(marker); marker.hidden = !should_be_shown(marker); }); this.hidden = all_hidden(mems); } } else { var marker = $(this).find('> td:first-child > .t-mark-rev'); this.hidden = !should_be_shown(marker); } }); $('.t-dsc .t-dsc-header').each(function() { var marker = $(this).find('> td > div > .t-mark-rev'); var lastheader = $(this).nextUntil(':not(.t-dsc-header)').addBack(); this.hidden = all_hidden(lastheader.nextUntil(':not(.t-dsc)')) || !should_be_shown(marker); }); var heading_selector = ['tr:has(> td > h5)', 'tr:has(> td > h3)']; $.each(heading_selector, function(i, selector) { $(selector).each(function() { var section = $(this).nextUntil(heading_selector.slice(i).join(',')); this.hidden = all_hidden(section.filter('.t-dsc')); }); }); $('.t-dsc-begin').each(function() { this.hidden = all_hidden($(this).find('.t-dsc')); }); } // Hide or show the navbar elements expanded from the {{nv ...}} template family. See documentation // at https://en.cppreference.com/w/Template:nv/doc . // A line of revision marker only controls a single entity name, even if it's expanded from // {{nv ln | ... }} that contains multiple lines. // If a heading contains a revision marker, that revision marker controls the visibility of the // heading and its corresponding contents; otherwise the heading is hidden when it is followed by // content elements, and all of them are hidden. function handle_nv() { $('.t-nv').each(function() { var marker = $(this).find('> td > .t-mark-rev'); this.hidden = !should_be_shown(marker); }); $('.t-nv-ln-table').each(function() { var lines = $(this).find('> div:nth-child(2) > .t-lines').children(); var mems = $(this).find('> div:first-child .t-lines').children(); lines.each(function(i) { var marker = $(this).children('.t-mark-rev'); if (mems[i]) mems[i].hidden = !should_be_shown(marker); marker.hidden = !should_be_shown(marker); }); this.hidden = all_hidden(mems); }); var heading_selector = ['.t-nv-h2', '.t-nv-h1']; $.each(heading_selector, function(i, selector) { $(selector).each(function() { var section = $(this).nextUntil(heading_selector.slice(i).join(',')); var marker = $(this).find('> td > .t-mark-rev'); if (marker[0]) { section.each(function() { this.hidden = this.hidden || !should_be_shown(marker); }); this.hidden = !should_be_shown(marker); } this.hidden = all_hidden(section.find('.t-nv-ln-table')); }); }); } // Hide or show the elements expanded from the {{rev ...}} template family. See documentation at // https://en.cppreference.com/w/Template:dcl/doc . // Borders are handled by class stdrev-rev-hide. function handle_rev() { $('.t-rev, .t-rev-inl').each(function() { this.hidden = !should_be_shown(this); }); } // Hide or show headings. // If the heading contains a revision marker, that revision marker controls the visibility of it // and its corresponding contents; otherwise, a heuristic is made: if the contents contain a dsc // list, and its revision-related contents are hidden, then the heading and all contents are hidden // as well. // The heuristic requires that handle_dsc() and handle_rev() have been called. function handle_headings() { var heading_selector = ['h5', 'h4', 'h3', 'h2']; $.each(heading_selector, function(i, selector) { $(selector).each(function() { var section = $(this).nextUntil(heading_selector.slice(i).join(',')); var marker = $(this).find('> span > .t-mark-rev'); if (marker[0]) { section.each(function() { this.hidden = this.hidden || !should_be_shown(marker); }); this.hidden = !should_be_shown(marker); } if (section.is('.t-dsc-begin') && !section.is(':not(p, .t-rev-begin, .t-dsc-begin)')) { var revisioned_content = section.find('.t-dsc, .t-rev, .t-rev-inl'); section.each(function() { this.hidden = this.hidden || all_hidden(revisioned_content); }); this.hidden = all_hidden(revisioned_content); } }); }); } // Hide or show <li> elements based on the contained revision markers. function handle_list_items() { $('li').each(function() { var marker = $(this).children('.t-mark-rev'); this.hidden = !should_be_shown(marker); }); } })(); |
Features include:
- hide section based on revision markers in the heading
- hide <li> based on its contained revision markers
- hide "Defined in header ..." when the corresponding entities are hidden
- implement renumbering inside {{v}}
- much shorter than P12's implementation! (~300LOC vs ~1800LOC)
Does it make sense to include this as an "official" gadget?
--223.3.167.101 10:25, 3 March 2019 (PST)
- We don't want to have two gadgets for the same thing. What does the current gadget do that this script doesn't, and vice versa? What caused the drastic shortening? T. Canens (talk) 11:07, 23 March 2019 (PDT)
- > What does the current gadget do that this script doesn't
- 1. be hosted on GitHub
- 2. have tests
- With regard to functionality, I don't know of any case that is handled better by Gadget-StandardRevision than by this script, but I don't have a thorough test.
- > and vice versa?
- All features mentioned above. Also, it does not have the problem reported below: Gadget-StandardRevision ignores all except the first revision marker in a row, and behaves unintuitively when the markers occupy more rows than the names in the dsc item. This script takes care to handle these cases better.
- > What caused the drastic shortening?
- Gadget-StandardRevision clones each of the elements that may be affected by the Gadget, and has a complex data structure to keep track of these elements and their clones. A lot of work is done to construct, manipulate, and debug this data structure. By contrast, this implementation directly manipulates the affected elements, which requires much less lines of code.
- --121.249.15.21 10:52, 24 March 2019 (PDT)
- The current gadget is also hosted on GitHub and has tests https://github.com/p12tic/cppreference-doc --Ybab321 (talk) 10:30, 26 March 2019 (PDT)
- Right, so I listed it as a thing that the current gadget do that this script doesn't :) --121.249.15.75 11:38, 26 March 2019 (PDT)
- The current gadget is also hosted on GitHub and has tests https://github.com/p12tic/cppreference-doc --Ybab321 (talk) 10:30, 26 March 2019 (PDT)
Search: noreturn - does not find en.cppreference.com/w/cpp/language/attributes/noreturn
How can I update the search system?
Several times I have searched for terms & not found them only to Google them & be given a cppreference page.
Also `Search: fallthrough` does not find en.cppreference.com/w/cpp/language/attributes/fallthrough.
And `Search: if constexpr` does not find en.cppreference.com/w/cpp/language/if.
I’m sure that there are more ...
Chris0 (talk) 18:50, 5 March 2019 (PST)
Updating the Embarcadero column
I'm a newly registered user, so cannot edit this page as it's under protection.
The Embarcadero column for C++14 and C++17 is out of date. The compiler supports all of C++14, and all of C++17 bar:
- Replacement of class objects containing reference members P0137R1
- Standardization of Parallelism TS P0024R2
- Elementary string conversions P0067R5
- Splicing Maps and Sets P0083R3
- Hardware interference size P0154R1
More info here: http://docwiki.embarcadero.com/RADStudio/Rio/en/Modern_C%2B%2B_Language_Features_Compliance_Status#C.2B.2B14_Features and http://docwiki.embarcadero.com/RADStudio/Rio/en/Modern_C%2B%2B_Language_Features_Compliance_Status#C.2B.2B17_Features
- yes, their new compilers are basically Clang: Embarcadero 10.1 is Clang 3.3, Embarcadero 10.3 (linked above) is Clang 5.0. But I suppose it's fair to update the table (for now, I updated the links below the table) --Cubbi (talk) 06:40, 8 March 2019 (PST)
Standard Revision gadget problems with C++20
It seems there are some problems with displaying (not displaying) features removed in C++20, On std::allocator page choosing C++20 Standard to be displayed, every removed feature is still on the list, marked as deprecated, information "removed in C++20" disappears. Is this template problem or widget problem? Kaznov (talk) 09:38, 15 March 2019 (PDT)
Shall we clarify on copy functions of standard exception classes?
Done |
---|
It seems that the existence and the postcondition of copy functions of standard exception classes (exception/2) are not mentioned in cppreference. --Fruderica (talk) 02:33, 31 March 2019 (PDT) |
sizeof parameter can't be a C-style cast
I'm not able to make this change, but would like to suggest it.
sizeof's notes ought to say something like:
With form (2), expression cannot be a C-style cast, due to ambiguity with form (1). In other words, sizeof (char)+1 is parsed as (sizeof(char)) + 1, rather than sizeof((char)+1). — Preceding unsigned comment added by Myria (talk • contribs)
std::sort() should mention strict weak ordering requirements
The description of std::sort() does not mention that the comparison operator comp must define a strict weak ordering. Unless the standard has changed, it is undefined behavior to sort with a comparison function which does not define a strict weak ordering.
It also is probably worthwhile to explicitly point out that sorting with a comparison function that does not define a strict weak ordering is undefined behavior, and in fact in common implementations can lead to a crash or infinite loop, since it's a really commonly-encountered pitfall.
It may also be worthwhile pointing out that operator< does *not* define a strict weak ordering over floating point values due to NaN behavior, and so std::sort() may crash when applied to a vector of floating point values.
I believe that std::stable_sort() has implementation defined behavior rather than undefined when there's not a strict weak ordering, so it might also be worthwhile recommending using std::stable_sort() in such cases.
SethML (talk) 10:41, 9 April 2019 (PDT)
- cpp/algorithm/sort says "Compare must meet the requirements of Compare." and cpp/named_req/Compare explains strict weak ordering and all other requirements on the comparison function. I suppose it could be highlighted, something like "must meet the requirements of Compare, including the strict weak ordering requirement", but then it sounds like there are cases where the ordering is not included. Maybe a concise bad example would be worth adding.
- As for stable_sort, the actual requirement uses the word of power "shall"], so it's undefined to violate that for both sort and stable_sort. --Cubbi (talk) 11:12, 9 April 2019 (PDT)
- Indeed, I've been reading the standards and discovering these things. I'd had this assumption that stable_sort() was implementation-defined over poorly-ordered sequences, but it appears that it's actually undefined and could crash. In practice I think most implementations are a merge sort, which should have some reasonable behavior given input which isn't strict weak ordered. But the standard doesn't guarantee that, sadly.
- The phrasing in the standard is: For algorithms other than those described in alg.binary.search, comp shall induce a strict weak ordering on the values.
- I'd missed that the Compare requirement encoded the strict weak ordering requirement - that's pretty subtle. I do think that for all of the sort functions, it'd be nice to expand the compare bullet point, something like:
- * Compare must meet the requirements of Compare, including the strict weak ordering requirement. If it doesn't the behavior of X_sort is undefined.
- A bad example using floating point could be a good way to call out UB with floating point collections, since that's a serious gotcha.
- I find it also an interesting question what the behavior of lower_bound and friends is if passed a sequence that is not partitioned with respect to the value being searched for. The standard does not use the word "shall" - it says: All of the algorithms in this subclause are versions of binary search and assume that the sequence being searched is partitioned with respect to an expression formed by binding the search key to an argument of the comparison function. What is your interpretation of the result if the sequence is not partitioned - undefined behavior, or implementation defined?
- "implementation-defined" is an additional standard requirement, not made here. I would say "undefined". If you feel strongly enough about it, consider raising an editorial issue on whether 'assume' in [alg.binary.search]/1 means the same as 'shall' in [alg.sorting]/3, and what does it mean to violate it (ill-formed? undefined? unspecified?) --Cubbi (talk) 06:54, 10 April 2019 (PDT)
- I find it also an interesting question what the behavior of lower_bound and friends is if passed a sequence that is not partitioned with respect to the value being searched for. The standard does not use the word "shall" - it says: All of the algorithms in this subclause are versions of binary search and assume that the sequence being searched is partitioned with respect to an expression formed by binding the search key to an argument of the comparison function. What is your interpretation of the result if the sequence is not partitioned - undefined behavior, or implementation defined?
Definintion of synchronizes-with in cpp/atomic/memory order?
The page cpp/atomic/memory order tries to be fairly formal with defining the different types of memory ordering constraints, but a definition for "synchronizes-with" (which "inter-thread happens-before" depends on) appears to be missing.
more copy & pastable header
On all the pages at the top it says "Defined in <X>". I think it would be better to do "#include <X>" instead so I can copy & paste that into my code directly.
135.23.100.188 12:00, 21 April 2019 (PDT)Ben
search widget takes me to wrong page when searching for restrict
Entering "restrict" into the search widget at the top of the page, takes you to https://en.cppreference.com/w/cpp/memory/gc/get_pointer_safety rather than https://en.cppreference.com/w/c/language/restrict
Not all error_codes are platform-dependent
In https://en.cppreference.com/w/cpp/error error_condition and error_error are described as:
error_condition (C++11) holds a portable error code
error_code (C++11) holds a platform-dependent error code
But that doesn't seem to be correct. See for example https://akrzemi1.wordpress.com/2017/07/12/your-own-error-code/#comment-6921 or http://blog.think-async.com/2010/04/system-error-support-in-c0x-part-2.html
- The descriptions are from overviews in the standard, see syserr.errcode.overview and syserr.errcode.overview. If you want to add something about the actual usage, I think we can add a "Notes" section to describe it. (By the way, the second article was written before C++11 so I doubt whether it is useful now.) --Fruderica (talk) 07:45, 27 April 2019 (PDT)
open source libs
How to add reference to open source lib? (Alex25 (talk) 01:20, 28 April 2019 (PDT))
Improving this site
I'm hardly a new user... can't I get edit rights (back)? CarloWood (talk) 09:18, 28 April 2019 (PDT)
BNFLite
Could you add nice BNFLite parsing h-library ( https://github.com/r35382/bnflite) into Text::Parse section
Language support page: list library support with the library name not the compiler name
The language support page lists compiler names in the list of library features. In a lot of Linux distributions, Clang will by default use GCC's libstdc++ instead of LLVM's libc++, which means that the relevant column to look at in that table for support when using Clang is the GCC column, not the Clang column. Likewise, clang-cl will use MSVC's standard library by default. (I think Intel's compiler behaves similarly to Clang in this regard, and indeed probably several other compilers in the table are not coupled to a particular standard library implementation.)
The current table structure seems less helpful than it could be.
Suggestion: rename the GCC column to libstdc++ and the Clang column to libc++; remove the columns for compilers that don't have their own standard library implementation; add introductory text explaining which standard library each compiler uses by default.
zygoloid (talk) 17:12, 4 May 2019 (PDT)
- this has been suggested as far back as 2016 Talk:cpp/compiler_support#Splitting_and_folding the_table and I don't think there is any opposition. Someone just needs to volunteer. --Cubbi (talk) 06:08, 6 May 2019 (PDT)
- Now I have placed core language features and library features into different tables, and renamed the columns when listing library features. However I think the introductory might be a hard work, since the compilers' default usage of standard library implementation is not well-documented. --Fruderica (talk) 21:54, 6 May 2019 (PDT)
Equivalence of the signature of function objects
Hi,
the documentation of (e.g.) std::accumulate says:
op The signature of the function should be equivalent to the following:
Ret fun(const Type1 &a, const Type2 &b);
The signature does not need to have const &.
When is a signature "equivalent" to the above? 2001:B01:2404:4:0:0:0:57 23:49, 9 May 2019 (PDT)
- This is handwaving vigorously. The basic requirement is that a set of expressions must work. But of course that's a bit abstract and we want to show what a function (object) that meets the requirement should look like. Hence the weasel-wording. Perhaps we should rephrase the requirements in terms of the required expressions, and then show sample signatures as examples? T. Canens (talk) 20:23, 17 May 2019 (PDT)
operator :: – ( I cannot edit https://en.cppreference.com/w/Talk:cpp/language/operator_precedence where it belongs to)
At https://en.cppreference.com/w/cpp/language/operator_precedence the token ::
that is used to build nested names is listed as an "operator". But AFAIK this token is not an operator (or a very special one).
Because for any (binary) operator ★ the term A★B★C
either means (A★B)★C
_or_ A★(B★C)
and you might add (…) to change the meaning.
But for :: you can't do this, because A::(B::C)
does not compile, and (A::B)::C
compiles, but is parsed as a type cast of ::C
into the type A::B
. :-/
What do you think? Should it be changed or at least mentioned? --Roker (talk) 04:01, 13 May 2019 (PDT)
- the whole table is a loose approximation of expression grammar in human-readable terms of "precedence" and "associativity". These terms do not appear anywhere in the language specification, they are invented by the authors of the table. In the expression grammar, :: combines identifiers into primary expressions, so inasmuch as the grammar can be expressed in those terms, it has the "highest precedence". We could drop it, but then people used to seeing precedence tables from other sources such as enwiki:Operators_in_C_and_C++#Operator_precedence would say cppreference's table is incomplete and add it back. --Cubbi (talk) 06:40, 13 May 2019 (PDT)
- They can already say that since cppreference's table does not include const_cast et al, though.
- OTOH, the standard calls :: an operator in [over.oper]/3. --D41D8CD98F (talk) 11:06, 14 May 2019 (PDT)
Add reference to paragraph about automatically generated class member functions
Hi there.
In https://en.cppreference.com/w/cpp/language/classes, I suggest in the last paragraph we add references to the rule of zero/three/five.
The very last sentence says:
"Some member functions are special: under certain circumstances they are defined by the compiler even if not defined by the user."
This would be an optimal place to refer to the rule of zero/three/five (link: https://en.cppreference.com/w/cpp/language/rule_of_three).
217.10.52.10 05:02, 13 May 2019 (PDT) André Malcher
Help to translate
Eu gostaria de ajudar a traduzir as páginas para o português do Brasil, por que tem grande diferenças do de Portugal.
Gostaria de saber como posso fazer isso?
Add argument types in the examples
https://en.cppreference.com/w/cpp/io/c/fprintf
Stupidly enough, despite the extensive examples, there is none using the argument types (e.g. %lu)
Add AI TP\O CURRlink title
https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai[1]
Add AI libraries for c++.
https://ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai[2]
AI using C++...
[ai.stackexchange.com/questions/6185/why-does-c-seem-less-widely-used-in-ai] is the source of the following. I have inserted links to the libraries web sites. You don't need a powerful language for programming AI. Most of the developers are using libraries like Keras,[keras.io] Torch [torch.ch], Caffe,[caffe.berkeleyvision.org] Watson [cloud.ibm.com/developer/watson/dashboard], TensorFlow,[www.tensorflow.org] etc. Those libraries are highly optimized and handle all the though work, they are built with high performance languages, like C. Python is just there to describe the neural network layers, load data, launch the processing and display results. Using C++ instead would give barely no performance improvement, but would be harder for non-developers as it require to care for memory management. Also, several AI people may not have a very solid programming or computer science background.
Another similar example would be game development, where the engine is coded in C/C++, and, often, all the game logic scripted in a high level language. Ian Martin Ajzenszmidt (talk) 05:39, 18 May 2019 (PDT)
Add See also: reference to <iomanip> from std::string?
Just a stray thought for improved navigation. For new C++ users that find themselves at [std::basic_string](https://en.cppreference.com/w/cpp/string/basic_string) and the next place many would need to go a majority of the time would be to <iomanip>. Would it be worth adding a ***See Also:*** reference to <iomanip>. Especially for those who do not yet know <iomanip> exists. Drankinatty (talk) 18:26, 18 May 2019 (PDT)
cpp/language/operator_comparison
first sentence of the the section Notes currently is:
Because these operators group left-to-right, the expression a<b<c is parsed (a<b)<c, and not a<(b<c) or (a<b)&&(b<c).
but the following would be clearer to understand:
Because these operators group left-to-right, the expression a<b<c is parsed (a<b)<c, and neither a<(b<c) nor (a<b)&&(b<c).
where can be donations be sent?
Hello ! I read about the donations, can you give me please more informations about whre can the donations be made? it will be very usefull. Thanks ! Sorry for disturbing the discussion page -Giani
contradiction in definition of std::filesystem::weakly_canonical
In the description of std::filesystem::weakly_canonical, it is stated that the parameter p must be an existing path. This is in contradiction with the description of the function std::filesystem::weakly_canonical, that states that p can consist of an existent left-hand-side and a non-existent right-hand-side.
Parallelism TS 2
- https://en.cppreference.com/w/cpp/experimental/simd needs to be linked from https://en.cppreference.com/w/cpp/experimental/parallelism_2.
- https://en.cppreference.com/mwiki/index.php?title=cpp/experimental/simd/abi_for_size needs to be renamed (as happend in the WD before the TS was published) to simd_abi::deduce.
- Most of the simd documentation needs to either be updated to TS state or written.
- I could help (author of that part of the TS).
Vir (talk) 03:12, 27 May 2019 (PDT)
suggestion for the Private Inheritance section
this sentence is hard to read:
Using a member offers better encapsulation and is generally preferred unless the derived class requires access to protected members (including constructors) of the base, needs to override a virtual member of the base, needs the base to be constructed before and destructed after some other base subobject, needs to share a virtual base or needs to control the construction of a virtual base.
this is much easier, using a list:
Using a member offers better encapsulation and is generally preferred unless the derived class: --requires access to protected members (including constructors) of the base --needs to override a virtual member of the base --needs the base to be constructed before and destructed after some other base subobject --needs to share a virtual base or needs to control the construction of a virtual base
75.142.108.70 14:01, 2 June 2019 (PDT)
Suggested addition for std::time page
Please add links to the following pages in the "See also" section of https://en.cppreference.com/w/cpp/chrono/c/time
https://en.cppreference.com/w/cpp/chrono/c/asctime https://en.cppreference.com/w/cpp/chrono/c/strftime
139.181.7.34 16:30, 4 June 2019 (PDT)
the headline for the non-throwing deletes is incorrect
functions 9-12 are headlined as placement versions, whereas they are non-throwing versions.
- new(nothrow) is placement-new by expr.new/15 --Cubbi (talk) 05:07, 6 June 2019 (PDT)
- now I see, cpp/memory/new/operator_new calls them "replaceable non-throwing", while cpp/memory/new/operator_delete calls them "replaceable placement".. Perhaps "non-throwing" is more user-friendly even if all of them are actually non-throwing --Cubbi (talk) 06:41, 6 June 2019 (PDT)
Only for multidimensional arrays?
I think the description should read "(potentially multidimensional) array" instead of "multidimensional array".
Can a standard exception object embed a fixed-size array?
The documentation for e.g. std::runtime_error, at
<https://en.cppreference.com/w/cpp/error/runtime_error>,
states:
"Because copying std::runtime_error is not permitted to throw exceptions, this message is typically stored internally as a separately-allocated reference-counted string."
Would it be OK to store the message into an array data member? That means that the string could have to be truncated, so the question is whether having a maximum length falls under possible implementation-defined limits. 37.182.205.198 03:06, 13 June 2019 (PDT)
- The string cannot be truncated because of the post-condition. Though I think that constructors of
std::runtime_error
takingconst char*
andconst std::string&
are still permitted to throw exception if the string is too long, and an array ofchar
embedded in the exception object is also permitted --Fruderica (talk) 03:55, 13 June 2019 (PDT)
std::size_t error in example
Reverse iteration. Unsigned variable taking values lower than 0.
for (std::size_t i = a.size()-1; i < a.size(); --i)
Should be:
for (std::size_t i = a.size()-1; i >= 0; --i)
- std::size_t is an unsigned integer type, so
i >= 0
always holds and the loop you suggested is endless. On the other hand, ifi == 0
then--i
makei
equals to the maximum value ofstd::size_t
which is almost always larger thana.size()
, so the loop will reach its end. If you don't like this, something like for (std::size_t i = a.size(); i != 0;) { --i;/*...*/} might be useful. --Fruderica (talk) 04:56, 21 June 2019 (PDT)
Typo on std::iterator page
Hi,
In the example section of the std::iterator page it says '.. _a_ input iterator ..' which should be '.. _an_ input iterator ..'.
Thanks for the truly excellent resource that is cppreference.
Best regards,
Kris van Rens 5.132.118.36 13:44, 22 June 2019 (PDT)
Enum syntax: trailing semicolon
It appears that on the enum declaration page, a trailing semicolon is missing at various places for the enum declarations.
cpp/utility/functional/bind/example
the following line is wrong:
f1(1, 2, 1001); // 1 is bound by _1, 2 is bound by _2, 1001 is unused
and it should be:
f1(1, 2, 1001); // 1 is bound by _2, 2 is bound by _1, 1001 is unused
Rob42 (talk) 07:55, 9 July 2019 (PDT)
- I believe the comment is correct as is, but given [3], [4], [5], [6] (all of them are wrong edits to the example) this line seems to have confused a lot of readers. I've edited the example in the hope to make it harder to misunderstand. --D41D8CD98F (talk) 10:26, 9 July 2019 (PDT)
Replace dead link in rule of three page with archive.org link
The link to the original source for the "rule of zero" on the page https://en.cppreference.com/w/cpp/language/rule_of_three is dead.
Perhaps change https://rmf.io/cxx11/rule-of-zero to https://web.archive.org/web/20160602100235/https://rmf.io/cxx11/rule-of-zero/
73.8.19.235 09:19, 10 July 2019 (PDT)joe
errno and strto* examples
On some examples, like strtol, errno is not reset before calling the function and is checked after an intermediate call to other functions, such as printf, which can set errno itself.
Although it is not relevant for the correct execution of the example, IMHO those code snippets should be a vehicle for promoting good practices. So I suggest to clear errno before calling strto* and test (or save) it immediately after the call.
79.151.6.162 10:19, 11 July 2019 (PDT)oscarfv
Subsume is synonym for implies.
On TS variant of concepts at: https://en.cppreference.com/w/cpp/experimental/constraints
You have inconsistency in your definitions/use of the word subsumes. Subsumes is synonym for implies by your first definition. (and also by C++20 standard version of concept https://en.cppreference.com/w/cpp/language/constraints)
1) "Concept P
is said to subsume concept Q
if it can be proven that P
implies Q
"
2) "A
subsumes a conjunction A&&B
and does not subsume a disjunction A||B
"
But
Mathematically in truth/boolean logic this is tautology for conjunction (always true):
A&&B
impliesA
and also always
A&&B
impliesB
so by first definition of word 'subsume' the second statement above should be other way around
A&&B
subsumesA
and also mathematically for disjunction (boolean logic):
A
impliesA||B
and also
B
impliesA||B
Now replace word implies for subsumes in those statements and you get contradiction again to your second statement 2).
Also note:
A||B
does not implyA
A||B
does not implyB
so again does not subsume.
On another note: You derive class to model 'is-a' relationship or subset relationship. You narrow down original big class of animals.
class Cat:Animal {}
Cat is an animal. Set of cats is subset of set of all animals.
Or you have implication "x is a cat implies x is an animal" , but not otherway around 'x is animal' does not imply 'x is a cat'. In concept language: Cat is additional constraint on top of animal. (Moveable and meowavle) and additional constraint makes class smaller subset and smaller subset means. So you either say Animal set subsumes Cats sub-set. Or you use 'subsume' for the characteristics (like in concepts). Cat characteristic subsumes Animal characteristics (x is a cat assumes/implies/subsumes x is a living being).
@ sign is displayed in place of overloaded operators
Sorry about the previous message, I accidentally posted an edited page instead of the suggestion.
Edit suggestion: @ sign is being displayed instead of operators !, << and ++ in Overloaded Operators section.
overload resolution links in using-declaration
In the inheriting constructors section of the using_declaration it would be great to add a link when overload resolution is mentioned.
unique_ptr better example
Hi! I think this example will be helpful on `std::unique_ptr` page. Somehow, I always struggle to remember that usage.
struct MyDeleter { void operator ()(int *val) { delete[] val; } }; typedef std::unique_ptr<int, MyDeleter> my_ptr; int main(int, char**) { my_ptr x(new int[10]); }
- I think it would be better to using std::unique_ptr<int[]>. --Fruderica (talk) 20:18, 26 July 2019 (PDT)
Strong ordering does not allow equivalence
I believe https://en.cppreference.com/w/cpp/utility/compare/strong_ordering is incorrect in listing "equivalent" as one of the possible values. Gio (talk) 19:57, 28 July 2019 (PDT)
- It allows. --Fruderica (talk) 01:53, 29 July 2019 (PDT)
- Right, thank you. But, then, shouldn't at least the descriptions for "equal" and "equivalent" be different? Gio (talk) 12:55, 29 July 2019 (PDT)
- But they aren't different in this case. equivalent = equal --Cubbi (talk) 13:45, 29 July 2019 (PDT)
- Right, thank you. But, then, shouldn't at least the descriptions for "equal" and "equivalent" be different? Gio (talk) 12:55, 29 July 2019 (PDT)
final specifier example typo
A::foo() comment should be fixed to: // Base::foo is overridden and it is the final override
Zhesson (talk) 09:27, 30 July 2019 (PDT)
FLT_MAX_EXP definition typo in climits
FLT_MAX_EXPDBL_MAX_EXPLDBL_MAX_EXP |
maximum positive integer such that FLT_RADIX raised by power one more than that integer is a normalized float, double and long double respectively (macro constant) |
This is incorrect; the similar page for C has the correct definition:
maximum positive integer such that FLT_RADIX raised by power one less than that integer is a normalized...
Unqualified name lookup->Class definition
I think a, c is incorrect because of class scope and his accessing rules - all names defined in class is available in entire class even if declaration is put below instruction of use.
d - if class is nested into another class then entire outer class will be searching and if name will still not found then local scope until definition class - because function accessing rules.
- the rules you're describing are a little lower, in cpp/language/unqualified_lookup#Member_function_definition --Cubbi (talk) 08:23, 2 August 2019 (PDT)
std::basic_fstream<CharT,Traits>::swap Example
https://en.cppreference.com/mwiki/index.php?title=cpp/io/basic_fstream/swap&oldid=50835 Example:
bool Create(string path, fstream & fs) { try { fstream fst(path, ios::binary | ios::trunc | ios::in | ios::out); if (!fst.is_open()) return false; fst.swap(fs); return true; } catch (...) { return false; } }
use
int main(void) { fstream fs; string path = "E:\\Downloads\\x125\\Cpp11.pdf"; if(File::Create(path, fs)) fs.write(path.c_str(), path.length()); return 0; }
— Preceding unsigned comment added by Rsarov (talk • contribs) 08:29, 2 August 2019 (PDT)
- ✔ Copied (with modifications) to fstream/swap page.--Space Mission (talk) 08:13, 16 June 2021 (PDT)
Concepts: PascalCase --> standard_case
Perhaps add a note about P1754 R0: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1754r0.pdf
- r1. And I think we're waiting for it to be actually merged into the draft (it's PR 3099 --Cubbi (talk) 05:04, 5 August 2019 (PDT)
main() is indented 4 spaces. Unlike the rest. Please make that 2 spaces.
main() is indented 4 spaces. Unlike the rest. Please make that 2 spaces.
PS Can't I get edit rights? I'm not vandalizing, so...
C fwrite missing error behaviour regarding file position.
If an error occurs, the resulting value of the file position indicator for the stream is indeterminate.
13.236.57.85 01:41, 6 August 2019 (PDT)
inconsistent find/rfind description
I don't think "find characters" is good wording for find on the main page of basic_string, should be "find substring" (or "find character sequence" as it's put in https://en.cppreference.com/w/cpp/string/basic_string/find) in order to avoid confusion with find_first_of. Also find/rfind titles should be consistent imo, "find the first/last occurrence of a substring" seems to be a good fit
https://en.cppreference.com/w/cpp/string/basic_string
find: "find characters in the string" rfind: "find the last occurrence of a substring"
180.183.72.126 22:38, 6 August 2019 (PDT) Vitaly
Memory leak in example on https://en.cppreference.com/w/cpp/locale/numpunct
I think the "new french_bool" in the example of https://en.cppreference.com/w/cpp/locale/numpunct leads to a memory leak so I would suggest to use a locale variable which can be freed at the end.
Best regards Stefan
195.242.227.17 03:07, 7 August 2019 (PDT)
Duplication for feature testing macros
The table cpp/preprocessor/replace#Language_feature-testing_macros duplicates cpp/feature_test#Language_features (with less information). It should be replaced by a link, e.g.:
The standard further defines a set of feature testing preprocessor macros corresponding to C++ language and library features introduced in C++11 or later. |
(since C++20) |
Ecatmur1 (talk) 04:17, 7 August 2019 (PDT)
Template:cpp/container/lower bound
Add "(i.e. greater or equal to)" after "that is not less than" (like the text on cpp/algorithm/lower bound).
tuple page's forward_as_tuple description not accurate
"forward_as_tuple creates a tuple of rvalue references "
It should be forwarding references rather than rvalue references
error in the example code for std::filesystem::create_directory
The line fs::permissions("sandbox/1/2/b", fs::perms::remove_perms | fs::perms::others_all); does not compile.
It should rather be
fs::permissions("sandbox/1/2/b", fs::perms::others_all, fs::perm_options::remove);
- David Bellot (talk) 16:15, 7 August 2019 (PDT)
Complexity of set algorithms
The complexity of all set operations (std::includes, std::set_difference, etc) is listed as follows:
At most 2·(N1+N2-1) comparisons, where N1 = std::distance(first1, last1) and N2 = std::distance(first2, last2)
This is different from the text in the standard (§ 23.7.6.1), which states:
Complexity: At most 2 * ((last1 - first1) + (last2 - first2)) - 1 comparisons.
The equation should be changed to 2·(N1+N2)-1 to match the standard.
Ryan Brown (talk) 12:59, 9 August 2019 (PDT)
Vertical propagation of allocators
The vertical propagation allocators is documented very poorly.
The std::std::scoped_allocator_adaptor<OuterAlloc, InnerAlloc...>
documentation gives the impression that it can be used with any allocator, however, it miserably fails when used together with std::polymorphic_allocator<T>
(see [1]). On the other hand, std::polymorphic_allocator<T>
already has the capabilities to propagate the allocator vertically as noted in [1], however, this is only noted in the constructor of the allocator, so this is very easy to miss.
My concrete suggestion is:
- Add a note in the
std::std::scoped_allocator_adaptor<OuterAlloc, InnerAlloc...>
saying that this is not needed whenOuterAlloc
is astd::polymorphic_allocator<T>
. - Promote and clarify the note in
std::polymorphic_allocator<T>::construct(...)
tostd::polymorphic_allocator<T>
so that it is clear that child continer-like objects will have the same allocators as the parent.
129.206.107.164 09:57, 10 October 2023 (PDT) sospinar