
Sebastian Redl wrote:
On 27.02.2012 07:15, Nevin Liber wrote:
When you specify what you mean by "not checked by the compiler", then we'll talk. :-) Until you do, it is trivial to poke holes in it. For instance:
if (0) { Fire Fire Fire! (note: this line is NOT a C++ comment) if (ShouldTheIf0OnlyGoToTheFirstEndBraceItFinds()) { } LaunchTheMissiles(); if (0) { }
Did you really mean to launch the missiles?
That's not Robert's obligation to answer, since the original static if proposal leaves the details of this question open as well. (Note, though, that Andrei said that at the very least, the parser would have to ensure that the tokens are brace-balanced in the dead branch. There is no sane way to parse the example you've just given.)
Robert's suggestion is just that "static if" can be replaced by "if" if the compiler is simply required to act as if the "if" was a "static if" if the condition is a constant expression.
Thanks for expressing this more clearly than I have.
I think this is feasible. I also think it obscures intent, which is why I'm against it.
It's easy to express intent without adding anything to the language /* static */ if .... I'm concerned about adding stuff to the language syntax which doesn't really add any functionality. This makes the language "bigger" to understand without making the functionality "bigger". C++ is already way to hard to understand and I don't think proposals like this don't reallly help. What this is really about is how to incorporate TMP functionality into the language in a way which doesn't make the language unreadable. OFF TOPIC Seems many people are familiar with Andre's talk, I'm curious how many here attended "GoingNative" -in person -via web broadcast Robert Ramey
Sebastian