Talk:Main Page/suggestions
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 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.
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)
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
- 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)
- 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)
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)
New user
I was puzzled by some example code using 23m and looked at the
C++ documentation for integer literal
|
page. A link to
C++ documentation for user literal
|
in the "See Also" section would have been very helpful. 217.158.111.130 06:14, 1 March 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)
Update description for Yato library
Hi Please update description for Yato library on the page "A list of open source C++ libraries"
New description: Modern C++(14/17) cross-platform STL-compatible library implementing containers, ranges, iterators, type traits and other tools; actors system; type-safe config interface. (Apache-2.0)
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)
Suggested addition to list of open source C libraries
Hi, this is a suggestion to add MQTT-C to the list of open source C libraries (https://en.cppreference.com/w/c/links/libs).
My proposed change would be to add the following to the Communications section.
Alternatively, if a non-GitHub url is preferred, https://liambindle.ca/MQTT-C is the official url for the MQTT-C documentation.
Information about MQTT-C
MQTT-C is an MQTT v3.1.1 client written in C. MQTT is a lightweight publisher-subscriber-based messaging protocol that is commonly used in IoT and networking applications where high-latency and low data-rate links are expected. The purpose of MQTT-C is to provide a portable MQTT client, written in C, for embedded systems and PC's alike. MQTT-C does this by providing a transparent Platform Abstraction Layer (PAL) which makes porting to new platforms easy. MQTT-C is completely thread-safe but can also run perfectly fine on single-threaded systems making MQTT-C well-suited for embedded systems and microcontrollers. Finally, MQTT-C is small; there are only two source files totalling less than 2000 lines.
Liambindle (talk) 20:16, 19 March 2019 (PDT)
A couple of suggestions for the libraries page
I would like to suggest a couple of libraries to add to the dedicated page:
- Backward for printing nice Python-styled stack traces (much better than Boost, at least on Linux) with colors and source snippets, especially on crashes. I use it and I find it very helpful. License: MIT.
- Frozen for constexpr perfect-hashing-based frozen sets and maps. Didn't actually use them (I needed something slightly different), but I came across it, they seems to be nice and they might be useful to other programmers. License: Apache 2.0.
Gio (talk) 01:22, 22 March 2019 (PDT)
string constructors page
The non-member function to_string could be in the "see also" section.
Suggesting code correction
Suggesting code correction: Example code should have "%u" instead of "%ju" inside printf. 188.124.215.85 05:12, 23 March 2019 (PDT)[email protected]
- ✘ Not done We only use
%ju
in one example, and that's correct because we are printing a uintmax_t. T. Canens (talk) 11:10, 23 March 2019 (PDT)
C++20 Draft Changes to [variant.helper]
Regarding: https://en.cppreference.com/mwiki/index.php?title=cpp/utility/variant/variant_alternative
As of the current C++20 draft, [variant.helper] specifies that variant_alternative<I, variant<Types...>>::type
is ill-formed if I
if not I < sizeof...(Types)
.
The current page does not reflect this.
Meowingtwurtle (talk) 20:00, 25 March 2019 (PDT)
Clarification on what a trivially copyable type is.
This passage: a trivially copyable type is any type for which the underlying bytes can be copied to an array of char or unsigned char and into a new object of the same type, and the resulting object would have the same value as the original
Should be instead:
a trivially copyable type is any type for which the underlying bytes can be copied to an array of char or unsigned char and back into a new object of the same type, and the resulting object would have the same value as the original
Why: The passage could be interpreted as saying "a trivially copyable type is a type where an object of type T copied to an array of char and object of type T copied to another object of type T such that the array of chars or the other object of type T have the same value as the original object of type T" instead of the intended interpretation that the object of type T is copied into an array of char and BACK into an object of type T.
- Modified the wording according to basic.types. Fruderica (talk) 04:36, 28 March 2019 (PDT)
Reg: memcpy_s is not working on any compiler
I tried using memcpy_s with the example mentioned in your page. I was able to compile but when i run the program it is not going inside the __STDC_LIB_EXT1__ macro.
- no C compiler or library vendor implemented Annex K of the C11 standard. There are two, I think, third-party libaries that implement Annex K only (I used one of them to test the examples). --Cubbi (talk) 06:06, 29 March 2019 (PDT)
Add link on EasyQtSql library to A list of open source C++ libraries
I would like to add link EasyQtSql - A lightweight header-only C++11 library for quick and easy SQL querying with QtSql to page cpp/links/libs (Databases section)
Kramolnic (talk) 02:06, 29 March 2019 (PDT)
Return types of overloads
The return types of the overloads of the double version (i.e. expint without any prefix) should actually be the same as the respective type of the argument and not default to double. Currently, the page lists the following declarations:
double expint( double arg ); double expint( float arg ); double expint( long double arg );
But ISO/IEC JTC 1/SC 22/WG 21 N3060 states in 8.1(4) on p. 10 et seq. that
"Moreover, each double version shall have sufficient additional overloads to determine which of the above three versions to actually call, by the following ordered set of rules: 1. First, if any argument corresponding to a double parameter in the double version has type long double, the long double version is called. 2. Otherwise, if any argument corresponding to a double parameter in the double version has type double or has an integer type, the double version is called. 3. Otherwise, the float version is called."
From my understanding, expint(1.0f) should call expintf(1.0f) and therefore should return float.
Other "Special mathematical functions" such as std::hermite and std::legendre have the same problem on cppreference.
--Thebrandre (talk) 02:30, 29 March 2019 (PDT)
- This rule was not merged into the standard when P0226R1 (Mathematical Special Functions for C++17, v5) was applied (https://github.com/cplusplus/draft/commit/014a1548ee76b12f252abe1591ffaede570f10d0). Should we report this as an issue in the standard? --D41D8CD98F (talk) 10:33, 29 March 2019 (PDT)
- at least an editorial, I imagine.. It makes no sense for a long double overload to return double, and at least GCC agrees. The rule that's in cmath.syn/2 applies, but says nothing of return types. --Cubbi (talk) 13:15, 29 March 2019 (PDT)
- Actually, the editorial issue was already raised: editorial #1247, although it had a bit of a scope expansion in discussion and spawned a different (though related) LWG issue that it has to wait for. both remain open --Cubbi (talk) 05:44, 1 April 2019 (PDT)
Shall we clarify on copy functions of standard exception classes?
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)
inconsistent capitalization
In https://en.cppreference.com/w/cpp/atomic/memory_order "thread 1" is capitalized inconsistently in the text description of the relaxed ordering - sometimes it's "thread 1", sometimes "Thread 1". Same for "thread 2".
Thanks, Dan 109.66.82.93 10:20, 31 March 2019 (PDT)
In https://en.cppreference.com/w/cpp/atomic/memory_order
Re "std::memory_order specifies how regular, non-atomic memory accesses are to be ordered around an atomic operation."
This seems incomplete because the order of other *atomic* memory accesses is also affected. (e.g. in the example shown under the relaxed order description, all operations are atomic). Thanks, Dan (talk) 10:23, 31 March 2019 (PDT)
- relaxed ordering example is not an example of such, but release-acquire ordering is (as it notes in the first sentence of cpp/atomic/memory_order#Release-Acquire_ordering). I'll try to reword the opening sentence. --Cubbi (talk) 05:51, 2 April 2019 (PDT)
Page about 'restrict' appears to have contradicting examples
I tried to start a discussion on the 'restrict' page itself, but a note about vandalism directed me here, I hope this is the right place...
The page I am talking about is this: https://en.cppreference.com/w/c/language/restrict
There is a section 'Function parameter' that in a code sample has this function in it: void f(int n, float * restrict a, float * const b). It then says about the function: "in the example above, the compiler can infer that a and b do not alias because b's constness guarantees that it cannot become dependent on a in the body of the function".
Later in the same paragraph, the page says "If the programmer were to write void f(int n, float * restrict a, float * const b), the compiler would be unable to infer non-aliasing of a and b without examining the body of the function."
That to me looks like the same piece of code the both times, and saying contradicting things about it. Was the later piece of code meant to not have the const in it?
- yes, thanks for spotting. The last piece of code was indeed meant to not have the const in it. It is Example 7 from C2x's paragraph 6.7.3.1/15. --Cubbi (talk) 13:13, 1 April 2019 (PDT)
cpp/language/ub#Signed overflow: stale link
Could someone please change the link to: https://godbolt.org/z/y4vIi1. Thank you! --Kijewski (talk) 22:57, 1 April 2019 (PDT)
Broken link
Page: https://en.cppreference.com/w/cpp/keyword "reflexpr" in the table refers to a non-existent page https://en.cppreference.com/w/cpp/keyword/reflexpr The page had a title visible in the page source: "cpp/keyword/reflexpr(页面不存在)" According to Google Translate, 页面不存在 means "Page doesn't exist" in Chinese. 65.61.62.12 16:19, 2 April 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).