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

That’s not a good example. Wrapping an integral value into a struct works exactly the same in C and (https://stackoverflow.com/questions/40629989/pros-and-cons-o...)

In C++ you can even add overloaded operators to make using math on such structs ergonomical.

Compilers know of the idiom, and will optimize the struct away.





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

Search: