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

Why not something as simple as `return (a - b)` ?

It’s concise and simple to understand. Instead of returning 1 or -1 it returns a positive or negative value with I think is equally effective.




> return (a - b)

That will overflow if a & b are longs.




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

Search: