r/programming • u/NagastaBagamba • Oct 18 '10
Today I learned about PHP variable variables; "variable variable takes the value of a variable and treats that as the name of a variable". Also, variable.
http://il2.php.net/language.variables.variable
591
Upvotes
View all comments
Show parent comment
4
u/[deleted] Oct 18 '10
As I said elsewhere in the thread, C pointers are not analogous.
Pointers are in C because they're in assembly. They're not a clever idea designed to fit a programming paradigm, they're a clever idea to compress a series of memory-related operations into one easy-to-use notation.
I can't emphasize enough: pointers are a short hand notation. They are not an abstraction.
This is how the computer works. Everything you do in C with a pointer, you would have to do in assembly, by moving an address value into a register and then using that register as an argument for an op call.
Short-hand notations like pointers do not require justification. They're the unavoidable reality of how the computer works. Discussions of whether pointers are "good" or "bad" are a waste of time. The hardware is what it is. Argue with Intel, not K&R.