|
|
|
|
|
by AnimalMuppet
881 days ago
|
|
Define "allowed". Will I get arrested? No. Will the compiler stop me? Also no. Will the program crash? Maybe. Almost certainly if I do it often, or without understanding. You aren't guaranteed to be safe if you access memory or addresses outside of allocations you've made (with stack and static memory counting as "allocations you've made). But on embedded systems with memory-mapped I/O, I have done things like *(unsigned long *)0xFFFE1404 = 0x00011472;
in order to write values to the registers of a peripheral device. Those I/O registers were memory that I "owned", even though I never allocated it in any way. |
|
But of course an implementation is free to define additional behaviors beyond the C specification. That’s done all the time. But that’s really a “flavor” of C and not pure “vanilla” C.