Hacker News new | past | comments | ask | show | jobs | submit login

I’m referring to this bit of the article:

The values of these comparison categories can be compared against the literal 0 (not any int, not an int whose value is 0... just the literal) using any of the six comparison operators...




Oh, this is particularly confusing, I agree.

IIUC it's referring to how you can safely evaluate the return value from a spaceship: by comparing against literal zero. (not how you would overload a comparison with literal zero).


C and C++ already have such a thing, IIUC. The literal 0 is considered the same as nullptr, if compared to another pointer.

It is a bit worrying that such an overloaded meaning is added again to the language.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: