burlachenkok / cpp_from_1998_to_2020 Goto Github PK
View Code? Open in Web Editor NEWTechnical Note: From C++98 to C++2x
Technical Note: From C++98 to C++2x
In the For People New to C++
there is following text:
you can capture returned temporary objects from a function by constant reference to reduce the number of copy constructors
That makes sense for C++03 and maybe C++11. In case of C++14 (or better) it is possible to return value even if copy and more constructors are explicitly deleted. I mean in this case it makes no sense to extend the life of the RValue.
The C++ code of the benchmark in the "[Why learn C++ if I know Python (Toy Example)" is not fair. Because code operate on local variables which do not have any aliases and a
is a regular C-array, C++ compiler can remove for()
loop completely and just set s
into some compile time value.
In the Introduction there is a statement:
C++ is complex, but currently, it's the fastest (in terms of execution speed in CPU) high-level, general-purpose programming language in the world.
You need a prove here. Otherwise would be better to reword it into "C++ is one of the most fastest ...."
I'm not sure if the following is right:
int x; const int *p; decltype(x) x1; // x1: int decltype(ptr) p1; // p1: int* decltype((ptr)) p2; // p1: const int*Extra parentheses are used to preserve const property for the type of expression.
Tried to compile that code and it seems decltype(ptr) p1
is equivalent to const int *p
, so you cannot modify the value pointed by pointer. And decltype((ptr)) p2
is an equivalent to const int * &p
.
BTW, there is a typo. There is no ptr
identifier. Do you mean p
?
I'm not sure I understand the text below:
- Support of varying array array. In C99, the last member of a structure can be a flexible array. In C++ it's possible as well.
- In C99, but not in C++, there is a flexible arrays. That arrays with a size specified via a non-const variable. In C99, to pass such arguments to a function, use the notation void g(int pp[*], int k){}.
What is the difference between flexible array
and varying array
?
In C++ there is open array:
void foo(int arr[], size_t arrSize)
{
}
From other side variable array
in the documentation is described as flexible array
here: https://wiki.sei.cmu.edu/confluence/display/c/DCL38-C.+Use+the+correct+syntax+when+declaring+a+flexible+array+member
In the Glossary in the description of the LValue
there is a statement:
Each value is implicitly converted to an RValue.
What do you mean by this?
As this is your work and you have reserved all rights for it, you can anything you want with them and rightfully so. However as these are public and the note states that contributions are welcome, it seems that at least one of the goals is to benefit the "greater C++ community".
Purpose of this issue is to ask you to consider different licensing options and how they could align with your goals for the note. As unlicensed work there are some obstacles to use it in some contexts. It also could discourage contributing to it.
If you decide to use some license, with assumption that one of the goals is to benefit C++ community, I would advocate to use some form of copyleft license such as GNU Free Documentation License or Creative Commons Attribution-ShareAlike.
I find great potential value in this technical note to C++ community, as C++ has been missing freely available book-like documentation that goes over the important parts. Thanks for putting effort in writing this and thanks for the editors for their effort in it.
Just wonder why is whole chapter formatted as a quote?
There is following line:
In C and C++, the components of the variable of structure type struct has addressed
I'm not really good in English, but looks like there are a few errors:
There is no language "C/C++". The continued use of such a term confuses people and propagates the misconception that there is. C and C++ are different languages with different ISO standards and different committees.
If you mean "C or C++", say that. If you mean "C and C++", say that. If you mean something else, please clarify appropriately.
A "technical note" on C++98 to C++20 should not contain such an incorrect term.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.