Date: Tue, 29 Apr 2025 19:54:19 +0100
>
Not related to the standardisation of C++, but another trick is to keep
track of which pages of memory are read-only, and to not bother copying the
string if it's in read-only memory. Of course this will only work properly
if your program doesn't change the permissions on pages of memory.
When I program microcontrollers I just check if the string address is less
than 0x20000, and then I know it's in Flash rather than RAM. No need to
copy it if it's in the read-only Flash.
Not related to the standardisation of C++, but another trick is to keep
track of which pages of memory are read-only, and to not bother copying the
string if it's in read-only memory. Of course this will only work properly
if your program doesn't change the permissions on pages of memory.
When I program microcontrollers I just check if the string address is less
than 0x20000, and then I know it's in Flash rather than RAM. No need to
copy it if it's in the read-only Flash.
Received on 2025-04-29 18:54:21