Closed Koldar closed 7 years ago
It's great inside a function that does not return the values you want in a one line. Useful in logs; for example:
info("my useful log %s", getBufferStringOfEdge(edge_instance, buffer));
here getBufferStringOfEdge returns the number of bytes consumed, but i want the buffer referenced. No problem, just use:
getBufferStringOfEdge
info("my useful log %s", (getBufferStringOfEdge(edge_instance, buffer), buffer));
Maybe a couple of example can be very useful!
I agreee. There are few scenarios where comma operator is useful. The one I've quoted in this issue is the one I've encountered during my code developing.
It's great inside a function that does not return the values you want in a one line. Useful in logs; for example:
here
getBufferStringOfEdge
returns the number of bytes consumed, but i want the buffer referenced. No problem, just use: