4 ms·
Mostly it just seems silly to use * for both pointers and arithmetic. We're not hurting for sigils even in ASCII.
by millstone 8y ago
Mostly it just seems silly to use * for both pointers and arithmetic. We're not hurting for sigils even in ASCII.
- jstimpfle 8y agoIn C, for example dollar-sign and at-sign are unused and could be used for pointers. But I don't like those. Both are visually clunky characters. Personally I like how it is in Pascal - caret sign for pointer types, and postfix unary operator caret for dereference, like^.this which doesn't need an additional syntax ( like->this is just (* like).this in C). But now, caret is usually also the XOR operator. The deeper problem is that Pascal cannot use caret as XOR binary operator since postfix operators cannot easily be distinguished from binary operators with only 1 token lookahead - it would require more lookahead or type resolution to determine that it's not a binary operator. While in C the deref operator is a prefix which can be distinguished from binary operators without lookahead.