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

C++ would be a lot better off if references were used more heavily. (And C ought to have references by now.) One still sees too many asterisks in C++ code. References are not supposed to be null. Sometimes they are, though, because there's no checking when a pointer is converted to a reference.

"this" should have been a reference, not a pointer. Strostrup admits that was a mistake.



technically references can't be null ever. To create a null reference you would have to deference a null pointer and then you are into nasal demons territory.

/pendantic


Pointers are easier to read than non-const references though (since they're more explicit).




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

Search: