Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

What is the point of a do { ... } while (false); construct? for example: do { \ UWtype __clz__b, __clz__c, __clz__x = (x); \ ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \ __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \ __clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \ __clz__x >>= __clz__b; \ __clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \ __cl

OpenStudy (anonymous):

do { \ UWtype __clz__b, __clz__c, __clz__x = (x); \ ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \ __clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \ __clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \ __clz__x >>= __clz__b; \ __clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \ __clz__b = 65 - __clz__b; \ (count) = __clz__b - __clz__c; \ } while (0)

OpenStudy (anonymous):

I know that it is possible to break; out of a do {...} while loop, but in that case why not just use a goto? I guess it's more structured using the do loop :-P

OpenStudy (anonymous):

you can also continue in a do { } while (false); loop :-P unlike gotos

OpenStudy (anonymous):

do garuntees that the code runs 1 time and while repeats it but if while cannot proceed the code still has run 1 time.

OpenStudy (anonymous):

This is useful and I recently learned it and I have a plan for it :)

OpenStudy (anonymous):

do does indeed run at least once, but what is the point of using it anyway if you write a condition that is always false?

OpenStudy (shadowfiend):

Well, goto is less structured in that it can literally jump you anywhere in the code. That makes while a little “safer”, in that you won't accidentally move something around and get behavior where you jump into the middle of another function.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!