Timeline for Text-based Tetris game
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 23, 2014 at 1:46 | comment | added | glampert | @MORTAL, yep, did the same test here with Clang and it zeroed the variables. Though like I said, it is best to explicitly initialize the data to leave no margin for doubt. | |
Dec 23, 2014 at 1:07 | comment | added | MORTAL | @glampert .. i ran test code for checking that, VC++ seems, it initializes objects just like being static. but still no document to verify it | |
Dec 22, 2014 at 23:57 | comment | added | glampert | @MORTAL, that's actually a very good question. I normally don't rely on the default zero initialization, and also prefer the explicit initialization for the clarity, so I wasn't sure if the namespace variables would be zero filled. According to this and this questions, they also qualify as static-storage, so are zero filled by default. | |
Dec 22, 2014 at 23:14 | comment | added | MORTAL | @glampert i just knew that static storage duration objects are zero initialized. is Anonymous namespace behave like static for initializing or not | |
Dec 21, 2014 at 21:02 | comment | added | Edward | @glampert: Excellent point -- thanks! I've updated my answer accordingly. | |
Dec 21, 2014 at 21:02 | history | edited | Edward | CC BY-SA 3.0 |
added note about anonymous namespace
|
Dec 21, 2014 at 20:15 | comment | added | glampert |
Nice answer, +1. One minor detail: Anonymous namespaces are preferred over static for file-scoped variables.
|
|
Dec 21, 2014 at 5:09 | history | edited | Brythan | CC BY-SA 3.0 |
Typo fixes.
|
Dec 20, 2014 at 21:02 | vote | accept | MORTAL | ||
Dec 20, 2014 at 20:53 | history | answered | Edward | CC BY-SA 3.0 |