sizeof is a compile-time operation so x need to be known at compile time.
It didn't work as expected. It turns out there is an exception and the standard says that sizeof is actually calculated at runtime specifically for variable length arrays:
> The sizeof operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant.
It is if the object can't be meaningfully cast to the type. I'd expect to get an exception. That's why they exist.
For example, consider explicitly casting the string "abc" to an int. Python throws a ValueError. Ruby silently ignores the problem and gives 0. I consider the Ruby behavior to be a gotcha.
The other NYC bridges are all (I think?) named Bridge, but they went with Crossing here because Outerbridge Bridge sounds weird.
Another NYC one: A lot of people think "major" in The Major Deegan Expressway means it is a significant expressway, but actually the expressway is named after (Army) Major William Deegan
The usual justification for having a concept of "undefined behavior" at all is specifically to allow compilers to "rule out this possibility" so they can make this sort of optimization.
log.exception is also usually bad when you are re-raising the exception. That often results in same stacktrace logged multiple times in a row which can be confusing or at least annoyingly verbose.
But it can be helpful to log an error message (without stacktrace) to give context that is available only in this frame before letting the exception propagate to whoever ultimately handles and logs it.
Walking past an eatery with outdoor seating, I overheard one diner say the phrase "process raw logs" and I thought, "wow, I guess that is one of those tricky problems that basically everyone ends up dealing with".
And then I heard "... with a chainsaw. It's a chainsaw mill" and realized I may have misunderstood the context.
In the 1990s, plenty of people felt obligated to drive to the mall, walk into B Dalton, and purchase a 300 page book to learn how to use their new software. There was a whole section for it.
Today, they can find the equivalent information for free without leaving the device where the software is running.