3 ms·
> Other egregious deviations from standard practice were the number of global variables in the system. (A variable is a location in memory that has a number in
by fnord77 11mo ago
> Other egregious deviations from standard practice were the number of global variables in the system. (A variable is a location in memory that has a number in it. A global variable is any piece of software anywhere in the system can get to that number and read it or write it.) The academic standard is zero. Toyota had more than 10,000 global variables.
- jdlshore 11mo agoMy understanding is that global variables are more common in embedded systems because it provides memory determinism.
- monegator 11mo agonah, by looking ad other people's firmware it's because most of my embedded colleagues are goats stuck in pre-ANSI C. You can always declare a "global" static, so it's not on the stack or heap, and access that via functions. Nothing wrong with source-file-level statics, you're bound to use them
- deleted 11mo ago[deleted]
- Glawen 11mo agoYep that's the standard in embedded on bare metal without memory allocation. There is a mechanism in place to synchronise data during interrupts, so it's not really direct write. Usually also coupled with a two complement variable or similar to make sure memory is not corrupted for safety critical data.