int *foo <-- good if we use pointers int &foo <-- good if we use references
Mind you, if we actually implement _pointers_, sscanf should most likely change to use them as well. Overall, the pointer syntax is more complex than references BUT it is more clear in the code (i.e if you call a method that takes a pointer, you need to specifically make the variable a pointer).
I'd really rather avoid sscanf("%d, %f", &it, &ft). But alas, 'int *foo' is better than 'ref(int) foo', 'pointer(int) foo' or similar constructions. Pike IS C/C++ like, so why invent a new _syntax_ when there's already a couple that are widely used?
/ David Hedbor
Previous text:
2003-04-16 01:44: Subject: Pointers/lvalues
I agree this much: ||
The lack of pointers is a major disadvantage right now at times. I often use mappings or dummy objects to implement pointers now, but that has a rather large overhead.
And using reference(x) instead of &x might be good for the beginner (but I am somewhat dubious), but I don't think it makes the code more readable, really.
If nothing else, more or less all programmers know the C-pointer syntax.
void silly( int *q ) { *q = 10; }
int var; silly( &var );
void silly( pointer(int) q ) { dereference(q) = 10; }
int var; silly( reference(var) );
/ Per Hedbor ()