P
Paul N
I had an idea the other day for a new operator for C and C++, which
acts like the comma operator but which returns the first value instead
of the second. For example, and using $ for my operator as it doesn't
seem to be already used,
return setupstuff() , calculatevalue() $ resetstuff();
would do the same as
setupstuff();
res = calculatevalue();
resetstuff();
return res;
but without needing the temporary value.
Is this a remotely sensible idea? Are there any cunning tricks (other
than RAII in C++) why it might not be necessary?
acts like the comma operator but which returns the first value instead
of the second. For example, and using $ for my operator as it doesn't
seem to be already used,
return setupstuff() , calculatevalue() $ resetstuff();
would do the same as
setupstuff();
res = calculatevalue();
resetstuff();
return res;
but without needing the temporary value.
Is this a remotely sensible idea? Are there any cunning tricks (other
than RAII in C++) why it might not be necessary?