What is the size of void?

The type void has no size; that would be a compilation error. For the same reason you can’t do something like: void n; EDIT. To my surprise, doing sizeof(void) actually does compile in GNU C: $ echo ‘int main() { printf(“%d”, sizeof(void)); }’ | gcc -xc -w – && ./a.out 1 However, in C++ it … Read more

Why are CSS named grid areas not in quotes?

The CSS Grid spec developers decided to use identifiers instead of strings, when defining named grid areas with the grid-area property, for the sake of consistency with the rest of CSS. The vast majority of CSS properties use identifiers, not strings, for their values. (Notable exceptions to this rule include font-family, content and grid-template-areas, which … Read more

A comprehensive survey of the types of things in R; ‘mode’ and ‘class’ and ‘typeof’ are insufficient

I agree that the type system in R is rather weird. The reason for it being that way is that it has evolved over (a long) time… Note that you missed one more type-like function, storage.mode, and one more class-like function, oldClass. So, mode and storage.mode are the old-style types (where storage.mode is more accurate), … Read more

Is it a conforming compiler extension to treat non-constexpr standard library functions as constexpr?

TL;DR In C++14 this is explicitly not allowed, although in 2011 it appeared like this case would be explicitly allowed. It is unclear if for C++11 this fell under the as-if rule, I don’t believe it does since it alters observable behavior but that point was not clarified in the issue I reference below. Details … Read more

What exactly is the “immediate context” mentioned in the C++11 Standard for which SFINAE applies?

If you consider all the templates and implicitly-defined functions that are needed to determine the result of the template argument substitution, and imagine they are generated first, before substitution starts, then any errors occurring in that first step are not in the immediate context, and result in hard errors. If all those instantiations and implicitly-definitions … Read more

Where exactly does C++ standard say dereferencing an uninitialized pointer is undefined behavior?

Section 4.1 looks like a candidate (emphasis mine): An lvalue (3.10) of a non-function, non-array type T can be converted to an rvalue. If T is an incomplete type, a program that necessitates this conversion is ill-formed. If the object to which the lvalue refers is not an object of type T and is not … Read more

Does “Undefined Behavior” really permit *anything* to happen? [duplicate]

Yes, it permits anything to happen. The note is just giving examples. The definition is pretty clear: Undefined behavior: behavior for which this International Standard imposes no requirements. Frequent point of confusion: You should understand that “no requirement” also means means the implementation is NOT required to leave the behavior undefined or do something bizarre/nondeterministic! … Read more