A question about EBCDIC compiler

Martin Sebor msebor@gmail.com
Tue Sep 15 19:46:32 GMT 2020


On 9/13/20 10:36 PM, sotrdg sotrdg via Libc-alpha wrote:
> How does the compiler deal with characters with EBCDIC string literals enabled?
> 
> How does glibc deal with EBCDIC compiler?
> For example
> 
> printf(“Hello World: %d\n”,4);
> 
> What encoding would this be on EBCDIC compiler? Will 4  become EBCDIC’s “4” or ASCII’s “4”?

GCC has a number of options that control the character sets it uses.
-finput-charset=<charset> tells it what character set to interpret
the source file in, and -fexec-charset=<charset> what multibyte
character set to use at execution time.

GCC can be configured to compile in an environment with one native
input character set and target an environment with a different set,
so the term "EBCDIC compiler" isn't completely unambiguous.  But
when it refers to a native GCC running on an EBCDIC host and
emitting code for an EBCDIC target there's no translation involved
since both charsets are EBCDIC.  It only becomes interesting when
the host and target charsets differ.

That said, not all parts of GCC honor the options so not everything
works completely seamlessly.  AFAIK, the -Wformat option, is one
that doesn't respect the charset options, so the -Wformat warnings
for printf format strings may not make complete sense (Joseph will
correct me here).  On the other hand, the -Wformat-overflow option
does respect the charset options so it should work correctly (there
are tests that verify it does).

Martin

> 
> How does the filename get dealt with on EBCDIC compilers?
> 
> 
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
> 



More information about the Libc-alpha mailing list