Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are some problems with that method though.

If, for example, you'd like to reverse the condition, you can't write

    if (!(MouseEvent *mouse = dynamic_cast<MouseEvent *>(event)))
    {}
because a definition is not a general expression, but was only added as an "extra" to allow its use in some cases in conditionals.


Oh, ok I didn't know. So it is indeed a syntactical shorthand for simultaneously declaring a variable and branching.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: