The following syntax is valid:
while (int i = get_data()) { }
But the following is not:
do { } while (int i = get_data());
Your first syntax is valid while the second is not. However, your while loop will loop forever, even if your function get_data() returns 0. Not sure if that's exactly what you want to happen.