Timeline for Are global variables evil in Arduino?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 11, 2017 at 22:50 | comment | added | underscore_d | This is a very well-rounded answer, expressing both points in favour of, and scepticism about, globals. +1 | |
| Jul 11, 2017 at 13:50 | comment | added | Andrew |
No. static is only for when you need to keep the value. If the first thing you do in the function is set the value of the variable to the current time there is no need to keep the old value. All that static does in that situation is wasting memory.
|
|
| Jul 11, 2017 at 13:37 | comment | added | ATE-ENGE |
Ok! I didn't know about static if I have a variable that is used only in one function but get a new value every time a function is called (like var=millis() ) should I make that static ?
|
|
| Jul 11, 2017 at 13:29 | history | answered | Edgar Bonet | CC BY-SA 3.0 |