David Barker wrote: ↑Tue Dec 13, 2022 12:24 pm
It hopefully will get fixed but internally, it's a complicated change to the compiler and I certainly don't want to break anything!
Nobody wants the latter
and thanks for the promise
.
Purely out of interest, why are you accessing a constant in this way in your code?
I was writing own strings library, slowly preparing to use SF in future projects, and that's when I noticed the discrepancy. Accessing characters from constant string is quite common, though, certainly, in most cases one may work around the lack of access by using arrays. In simple example of converting decimal to hex string, one may use string constant "0123456789ABCDEF" or type almost four times as many characters to form a character array ("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F")
.
BTW, though nominally SF allows for strings of up to 255 characters, in practice one may work with longer ones (even internal routine copying constant string to string variable does it well). The only real limitation comes from the fact that one cannot pass constant strings by reference above the 64kB limit as the address is limited to 2 bytes (well, only constant string array elements - using string constant invokes 'expression cannot be passed by reference' error). Happily, one may easily work around this, even if it causes disparity in passing string variable and string constant parameters so I was able to make my strings library to work with strings (both variable and constant) longer than 255 characters and address constants in any part of flash.