Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for Pete W
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Answer | — |
A: What is do { } while(0) in macros and should we use it? Reasons to use the construct `#define FOO(x) do{...} while(0);`: 1. As mentioned above, doing so solves the problem of ``` if (...) FOO(y); ``` 1. You can declare variables inside the block, and they harmlessly go out of scope at the end of the block. Without the `do{}` block, ... (more) |
— | over 3 years ago |