Valid, but worthless syntax in switch-case?

Through a little typo, I accidentally found this construct: int main(void) { char foo = ‘c’; switch(foo) { printf(“Cant Touch This\n”); // This line is Unreachable case ‘a’: printf(“A\n”); break; case ‘b’: printf(“B\n”); break; case ‘c’: printf(“C\n”); break; case ‘d’: printf(“D\n”); break; } return 0; } It seems that the printf at the top of … Read more

What are Rust’s exact auto-dereferencing rules?

I’m learning/experimenting with Rust, and in all the elegance that I find in this language, there is one peculiarity that baffles me and seems totally out of place. Rust automatically dereferences pointers when making method calls. I made some tests to determine the exact behaviour: struct X { val: i32 } impl std::ops::Deref for X … Read more

A positive lambda: ‘+[]{}’ – What sorcery is this? [duplicate]

This question already has an answer here: Resolving ambiguous overload on function pointer and std::function for a lambda using + (unary plus) (1 answer) Closed 8 years ago. 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 = []{}; … Read more

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

Consider the main axis and cross axis of a flex container: Source: W3C To align flex items along the main axis there is one property: justify-content To align flex items along the cross axis there are three properties: align-content align-items align-self In the image above, the main axis is horizontal and the cross axis is … Read more