This is a followup on the answers for placement new on a class with reference field. Calling std::vector<A>::data() on type A that has reference or const
According to C99 Standard: The order of evaluation of the function designator, the actual arguments, and subexpressions within the actual arguments is unspe
In the following program, struct B has two user-defined constructors: one from int and another from int&& (clearly this is not very practical). And an o
Consider the following code snippet where we we're trying to deduce the template parameter to the function foobar(): struct Bar { static constexpr auto size =
Is the following code legal according to the standard? #include <new> int main() { const int x = 3; new ((void *)&x) int { 1
In reading How are char arrays / strings stored in binary files (C/C++)?, I was thinking about the various ways in which the raw string involved, "Nancy", would
I was reading an SO post where one user made the following comment: Also note that ArrTest<int> ar(); uses most vexing parse. But another user said the
Inspired by: Why is std::aligned_storage to be deprecated in C++23 and what to use instead? The linked proposal P1413R3 (that deprecates std::aligned_storage) s
I'm trying to get a better understanding of the C standard. In particular I am interested in how pointer arithmetic might work in an implementation for an unusu
It seems that currently _Thread_local is independent from __STDC_NO_THREADS__. Consequence: even if an implementation defines __STDC_NO_THREADS__ to 1, then it
I've just read What is the purpose of std::launder? and frankly, I am left scratching my head. Let's start with the second example in @NicolBolas' accepted answ
Consider this piece of code: struct Base { int x; }; struct Bar : Base { int y; }; struct Foo : Base { int z; }; Bar* bar = new Bar; Foo* foo =
What is the rationale for why std::stof, std::stod, and std::stold throw exceptions? http://en.cppreference.com/w/cpp/string/basic_string/stof Input errors are
In the case that a local jmp_buf is actually represented by registers rather than stack memory, is it possible for setjmp or longjmp to cause the contents of th
When I try to compile this code import java.util.Optional; public class GenericTest { public static void main(String[] args) { Optional.empty().m
I am trying to define a union struct with some struct and primitive members overlapping in memory with a simple array. This works perfectly in Clang and MSVC, b
To value-initialize an object of type T means: ... — if T is a (possibly cv-qualified) class type without a user-provided or deleted default constructor,
The C++ standard says that unqualified names from nondependent base classes are preferred over template parameters. What is the reasoning behind this? The follo
I recently learnt that constructors do not have names in C++ and some other things about them. I am also aware that a function has a type in C++ called a functi
Scott Meyers writes in Effective Modern C++ (Item 30 page 210) that there's no need to define integral static const data members in classes; declarations alone