behavior of static variables inside functions. Also i can't see anything you described in my armv7e-m disassembly 🤔
Is it maybe OS/compiler dependent? Would be nice to know if and whers something like u describe exists
they are static local variables
https://godbolt.org/z/ReY13f
on ARM: https://godbolt.org/z/XcxPNy
Variables declared at block scope with the specifier static have static storage duration but are initialized the first time control passes through their declaration
This article describes behavior of static variables inside any block , including function body. https://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables Unless section (unless their initialization is zero- or constant-initialization, which can be performed before the block is first entered)says that in these particular cases initialization can be performed earlier then first time control passes through the declaration.
Обсуждают сегодня