5 ms·
Just curious: why might @ be preferred over &?
by maxmcd 6y ago
Just curious: why might @ be preferred over &?
- williamdclt 6y agoAs anecdote, my brain parses it more easily because I read "at", so I automatically interpret the expression as an address. Like "get the value at argv+1"
- conradludgate 6y ago& isn't even the dereference operator, right? That's what gives you the pointer. * gives you the value at the pointer. I guess that's why it's preferable, in English it reads nicely and describes exactly what it does. `val arg = @(argv + 1)` reads like "val arg is the value at argv + 1"
- maxmcd 6y agowhoops you are correct. interesting, thanks
- miccah 6y agoI always read & as "at" mentally when reading code :)
- 2OEH8eoCRo0 6y agoI read it as "address of" but @ definitely works if we are talking about an address. The value is @x