Skip to main content
Arduino

Timeline for Use of "static" with "RTClib"

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Apr 23, 2020 at 18:22 comment added blackdaw @KIIV You are right. I picked up many misconceptions through "beginner guides". The one you linked is a very helpful guide, thank you!
Apr 23, 2020 at 17:26 comment added KIIV @blackdaw I'm pretty sure it's about declaration and definition of Class methods, not variables. And non rules/myths: Don't insist that all declarations shoudl be at the top of function and two rules Don't introduce a variable (or constant) before you need to use it
Apr 23, 2020 at 17:13 comment added blackdaw @KIIV , concerning C++ I've read many times that separate declaration and definition can be part of "good practice". Your explanation was never mentioned but seems to make sense! Maybe it makes no difference with (aggressive) compiler optimization?
Apr 23, 2020 at 17:05 comment added blackdaw @EdgarBonet , it compiles and uploads but will not execute Setup(). Setup() starts with Serial.begin(9600); Serial.println("test"); Blinking the builtin-led doesn't work either.
Apr 23, 2020 at 3:38 history became hot network question
Apr 22, 2020 at 21:51 comment added KIIV Actually, DateTime now = rtc.now() might have utilize "copy elision", so it gets constructed directly into now variable and therefore it's faster than your approach (as you effectively blocked this possibility - so it has to create temporary object and copy it into now variable).
Apr 22, 2020 at 20:30 vote accept blackdaw
Apr 22, 2020 at 20:28 comment added Edgar Bonet Re "I CAN NOT declare DateTime now; in global scope": what happens if you do so? A compilation error? Incorrect run-time behavior? I tried and it compiles just fine (but I have no RTC for testing).
Apr 22, 2020 at 20:07 answer added Edgar Bonet timeline score: 2
Apr 22, 2020 at 19:58 history edited blackdaw CC BY-SA 4.0
Need for static specified ; can't declare in global scope
Apr 22, 2020 at 19:47 answer added Michel Keijzers timeline score: 1
Apr 22, 2020 at 19:42 review First posts
Apr 22, 2020 at 21:34
Apr 22, 2020 at 19:37 history asked blackdaw CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /