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

degToRad wasn’t the point, the list of cosines being computed at compile time was the point… or something similar, or something different… use your imagination. I used cosf() because it’s clearly a function call doing compile time compute, and I suggested a list because it makes a more clear case for compile time compilation, and because that might start to get into the reasons one would want constexpr allocation. And yes of course a good compiler absolutely will turn things into constants if it can, regardless of how they’re declared, including without any special const* specifiers at all. That is not why either const or constexpr exist, right?


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: