On 9/24/18 3:18 PM, Patrick Schluter wrote:
On Monday, 24 September 2018 at 13:26:14 UTC, Steven Schveighoffer wrote:
2. There are no rules about what *encoding* is acceptable, it's
implementation defined. So various compilers have different rules as
to what will be accepted in the actual source code. In fact, I read
somewhere that not even ASCII is guaranteed to be supported.
Indeed. IBM mainframes have C compilers too but not ASCII. They code in
EBCDIC. That's why for instance it's not portable to do things like
if(c >= 'A' && c <= 'Z') printf("CAPITAL LETTER\n");
is not true in EBCDIC.
Right. But it's just a side-note -- I'd guess all modern compilers
support ASCII, and definitely ones that we would want to interoperate with.
Besides, that example is more concerned about *input data* encoding, not
*source code* encoding. If the above is written in ASCII, then I would
assume that the bytes in the source file are the ASCII bytes, and
probably the IBM compilers would not know what to do with such files (it
would all be gibberish if you opened on an EBCDIC editor). You'd first
have to translate it to EBCDIC, which is a red flag that likely this
isn't going to work :)
-Steve