On May 1, 11 21:23, lenochware wrote:
== Quote from KennyTM~ ([email protected])'s articleYou could use x"" string, or just escape those characters auto x = x"f1f2f3 f4"; auto y = "\xf1\xf2\xf3\xf4"; (And if your "string" is not a UTF-8 string at all, you should use a ubyte[], not char[]. const(ubyte)[] z = [0xf1, 0xf2, 0xf3, 0xf4]; auto t = cast(const(ubyte)[]) x"f1f2f3f4"; )It would be very unclean write strings this way, but it is not so important.
It's very *unportable* to write a string in your way. Not every editor/OS default to ISO-8859-1 when an encoding is not found (say Notepad.exe), and your source file is likely destroyed because when I "Save As..." it all those 'åéüîø' becomes '?????', or the file is re-encoded into UTF-8, and the program will think you've actually written 'åéüîø'.
(Of course that also happens to UTF-8. Therefore it's best to restrict to ASCII only.)
> The point is that I don't like features which cannot be disabled. For example
variables in D are initialized, which is good, but you can write int i = void; and disable it. The final decision is on the programmer. You are not forced to do it only one "good" way.
If D allowed non-UTF encoding without error, it's possible that a string in those settings got misinterpreted, but it's not easy to determine when.
That's different from '= void' or 'cast' is those are *explicit*.
This is philosophy which I like. Of course, I understand that it is not possible make everything optional, it has negatives, like everything has, but if there are serious doubts about some feature and it is not big deal to make it optional, it SHOULD be optional. At least I think so.
Yes it's possible that DMD add a -wno-utf-warning switch. But you'd have better chance convincing Walter to split the different -w options :).
