Date: Fri, 14 Nov 2025 14:38:23 +0000
Microcontrollers have a single address space for non-volatile and
volatile memory.
0x0 - 0x2000 might be the non-volatile Flash
0x2000 - 0x8000 might be the volatile SRAM
At runtime, the flash can be toggled writable or read-only.
Similarly on desktop PC's, a page of memory can be toggled from
writable to read-only.
If we store a 'const' object in a section of memory that later gets
set read-only, we need to be sure that it is really a const object --
i.e. it can't contain mutable members.
So I've implemented "std::contains_mutable". Here's my compiler patch
for GNU g++:
https://github.com/healytpk/gcc-thomas-healy/commit/tag_contains_mutable
And here it is tested up on GodBolt:
https://godbolt.org/z/KosvqTETo
Looking over the recent papers on reflection . . . I think this would
be done in reflection as follows:
https://godbolt.org/z/4ezv58zxx
volatile memory.
0x0 - 0x2000 might be the non-volatile Flash
0x2000 - 0x8000 might be the volatile SRAM
At runtime, the flash can be toggled writable or read-only.
Similarly on desktop PC's, a page of memory can be toggled from
writable to read-only.
If we store a 'const' object in a section of memory that later gets
set read-only, we need to be sure that it is really a const object --
i.e. it can't contain mutable members.
So I've implemented "std::contains_mutable". Here's my compiler patch
for GNU g++:
https://github.com/healytpk/gcc-thomas-healy/commit/tag_contains_mutable
And here it is tested up on GodBolt:
https://godbolt.org/z/KosvqTETo
Looking over the recent papers on reflection . . . I think this would
be done in reflection as follows:
https://godbolt.org/z/4ezv58zxx
Received on 2025-11-14 14:38:36
