|
|
|
|
|
by alterom
32 days ago
|
|
>It is useful to distinguish between consuming an element and only jumping to it. So you would have an ptr[i++] for consuming the current token, but not, when you are switching to another token. So, it's trivial to do it with a function. Or a macro. int adv(int *i){
int t = *i;
(*i) = t + 1;
return t;
}
while(i < 10)
printf("%d\n", adv(&i));
Not to mention, iterators and all that jazz.The point is, you don't need assignment to return a value to have this. Can you give a non-contrived example where you really need it? >It's obvious that you do prefer the stylistic choices Go made, but that doesn't mean everyone does. It's not that I "prefer stylistic choices of Go", it's that I hate to have undefined behavior in language spec which is easy to stumble into - the cost of the "stylistic choice" that C made doesn't make that choice justified. |
|