Timeline for Will unnecessary Serial.print() statements slow down my program?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:37 | history | edited | Community Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Sep 5, 2016 at 7:38 | history | edited | Nick Gammon ♦ | CC BY-SA 3.0 |
Added more explanations.
|
Sep 4, 2016 at 21:09 | comment | added | Nick Gammon♦ |
Semicolon is not part of the macro - you edited your post after I made mine. In your original post (as you can see from what I copied/pasted) you had semicolons.
|
|
Sep 4, 2016 at 13:20 | comment | added | KIIV |
@Majenko But if you have: #define MACRO() {} and you'll use it as: if (...) MACRO(...); else ... (notice that semicolon) it will turn into if (...) {}; else ... . That's why the pattern do { ... } while(0) is used sometimes instead of simple block { ... }
|
|
Sep 4, 2016 at 11:33 | comment | added | Majenko |
A way around the if(...) [macro] problem is, when debugging is turned off, to define your macros to equate to {} , such as #define LOG(...) {} , then the if(...) turns into if(...) {}
|
|
Sep 4, 2016 at 8:50 | comment | added | KIIV |
Semicolon is not part of the macro, so it will be expanded into: if (something) ;
|
|
Sep 4, 2016 at 7:54 | history | answered | Nick Gammon ♦ | CC BY-SA 3.0 |