All Questions

319
votes
4answers
59017 views

In CSS Flexbox, why are there no "justify-items" and "justify-self" properties?

Consider the main axis and cross axis of a flex container:                        &...
100
votes
2answers
12248 views

When does invoking a member function on a null instance result in undefined behavior?

Consider the following code: #include <iostream> struct foo { // (a): void bar() { std::cout << "gman was here" << std::endl; } // (b): void baz() { x = 5; } ...
83
votes
5answers
9286 views

Accessing inactive union member and undefined behavior?

I was under the impression that accessing an union member other than the last one set is UB, but I can't seem to find a solid reference (other than answers claiming it's UB but without any support fro...
56
votes
1answers
2981 views

Has C++ standard changed with respect to the use of indeterminate values and undefined behavior in C++14?

As covered in Does initialization entail lvalue-to-rvalue conversion? Is int x = x; UB? the C++ standard has a surprising example in section 3.3.2 Point of declaration in which an int is initialized w...
64
votes
13answers
5729 views

Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?

I have seen it asserted several times now that the following code is not allowed by the C++ Standard: int array[5]; int *array_begin = &array[0]; int *array_end = &array[5]; Is &array[5...
51
votes
4answers
2066 views

Does initialization entail lvalue-to-rvalue conversion? Is `int x = x;` UB?

The C++ standard contains a semi-famous example of "surprising" name lookup in 3.3.2, "Point of declaration": int x = x; This initializes x with itself, which (being a primitive type) is uninitiali...
85
votes
9answers
5413 views

Does "Undefined Behavior" really permit *anything* to happen?

EDIT: This question was not intended as a forum for discussion about the (de)merits of undefined behavior, but that's sort of what it became. In any case, this thread about a hypothetical C-compiler w...
40
votes
2answers
20243 views

Fortran: integer*4 vs integer(4) vs integer(kind=4)

I'm trying to learn Fortran and I'm seeing a lot of different definitions being passed around and I'm wondering if they're trying to accomplish the same thing. What is the difference between the follo...
220
votes
1answers
18902 views

A positive lambda: '+[]{}' - What sorcery is this?

In Stack Overflow question Redefining lambdas not allowed in C++11, why?, a small program was given that does not compile: int main() { auto test = []{}; test = []{}; } The question was ans...
9
votes
3answers
2787 views

Order of evaluation of arguments using std::cout

Hi all I stumbled upon this piece of code today and I am confused as to what exactly happens and more particular in what order : Code : #include <iostream> bool foo(double & m) { m ...

Previous Next