You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I believe this is a fairly seldom-used feature of C, but would there be any possibility of adding in C wide string constants to C3?
Ordinary C usage:
char16_t*MyString=L"Compile-time wide string as a raw array of bytes; no frills";
This feature is useful when writing for constrained environments that do not support higher-level language constructs like WString (i.e. when not using the stdlib --> --use-stdlib=no / --link-libc=no).
Plenty of firmware/loaders utilize this feature regularly per UEFI requirements. In my current C3 testing with UEFI, I've been dynamically converting normal char arrays to wchar arrays using the UEFI allocator to get by.
--
In C3, raw strings and other string constant types could also use this L prefix.
It's possible I missed this in the language documentation as some other feature. The FourCC character literals get close, but they don't allow a complete string-like capability without manually creating an inline array of them.
The text was updated successfully, but these errors were encountered:
I could perhaps add a builtin for it, so rather than adding the L prefix, it would be something like @stringw("Hello world"). Would that be sufficient?
@lerno Absolutely, I think that would get the job done for a more obscure feature of the language, especially one that probably isn’t worth the effort of a whole new string prefix.
Leveraging the builtin, I will likely do my best to hack a way to make it as concise as possible with macros/preprocessing after the fact.
Hi, I believe this is a fairly seldom-used feature of C, but would there be any possibility of adding in C wide string constants to C3?
Ordinary C usage:
This feature is useful when writing for constrained environments that do not support higher-level language constructs like
WString
(i.e. when not using the stdlib -->--use-stdlib=no
/--link-libc=no
).Plenty of firmware/loaders utilize this feature regularly per UEFI requirements. In my current C3 testing with UEFI, I've been dynamically converting normal char arrays to wchar arrays using the UEFI allocator to get by.
--
In C3, raw strings and other string constant types could also use this
L
prefix.It's possible I missed this in the language documentation as some other feature. The FourCC character literals get close, but they don't allow a complete string-like capability without manually creating an inline array of them.
The text was updated successfully, but these errors were encountered: