3 ms·
A pointer to an int "should" be &int, not int*. That we use *, the dereference operator, to indicate pointers is wrong. * in a type means it's an addr
by earthboundkid 7y ago
A pointer to an int "should" be &int, not int*. That we use *, the
dereference operator, to indicate pointers is wrong. * in a type means it's an
address, but * in a value means it's not an address. That's nuts! Make it
consistent and use & both places. If you need to have a distinction between
refs and pointers, it should be that pointers are nullable refs: &int? or some
such.
Edit: How to escape asterisks in HN?
- saagarjha 7y agoI’ve had luck with not putting something directly after the asterisk.
- earthboundkid 7y agoApparently HN does not have an escape character which seems like a real oversight. :-/
- mariodiana 7y agoI think you may be right, &int would be better than int*. I did not want to stray too far from what C does now, for the sake of argument. I just wanted to say that the ambiguity in C is often because it's so loosey-goosey with whitespace.
- deleted 7y ago[deleted]