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

> constexpr, as you suggest

I made no mention of constexpr.

Program start-up isn't compile time.

The idea is that since "static obj bar()" doesn't depend on anything in the function, it could in principle be moved outside of the function. So in actual fact, it can be treated that way by the loading semantics of the program (can be constructed without the function having to be called), except that the name bar is only visible inside the function.

I don't understand why C++ wouldn't have specified it this way going back to 1998, but that's just me.



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: