Supposing we have:Many introductions to C++ (like this one) suggest that the rvalues a+i and &a[i] are interchangeable. I naively believed this for several decades, until I recently stumbled upon the following text (here) quoted from [dcl.ref]:
Inspired from this answer, which claims to subvert the access control system, I wrote the following minimal version of the hack
I seem to have found something that clang and gcc disagree on. Here's the code:This successfully compiles with gcc 7.4.0 but fails with clang 7.0.0 with this error message:
In standard jargon of C and C++, the phrase "atomic object" means "object of atomic type," does it not?
Recently I decided to dive into the C++ Standard and check whether certain code snippets are well defined and where to find those definitions in the standard. Since the standard is rather hard to get right (especially if you are not used to it) I wanted to verify if my...
According to P1236R1, now integer types are defined with numbers, no longer with bits.Instead of defining the meaning of "bit", which the standard is still lacking, C++ chooses not to do that but defines those types in the term of range exponent instead.
Answers to What are the differences between Rust's `String` and `str`? describe how &str and String relate to each other.
=> isn't overloadable in C++. I have always wondered whether this is just a pure coincidence or whether there is a specific reason this sequence of two characters cannot be overloaded. The emergence of the comparison operator <=> leads me to believe the former.
Consider the following piece of code:The latest versions of GCC (8.2) and Clang (7.0.0) fail to compile it. So does ICC (19.0.1). However MSVC (v19.16) compiles it cleanly.
The following code compiles well in gcc 7.3.0, but doesn't compiles with clang 6.0.0. I used command clang++ 1.cpp -std=c++98 with specifying different standard versions. I tried c++98,11,14,17,2a. In all cases an error is the same. Error message in clang is following: