public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* A question about EBCDIC compiler
@ 2020-09-14  4:36 sotrdg sotrdg
  2020-09-14  8:54 ` Florian Weimer
  2020-09-15 19:46 ` Martin Sebor
  0 siblings, 2 replies; 4+ messages in thread
From: sotrdg sotrdg @ 2020-09-14  4:36 UTC (permalink / raw)
  To: libc-alpha

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”?

How does the filename get dealt with on EBCDIC compilers?


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about EBCDIC compiler
  2020-09-14  4:36 A question about EBCDIC compiler sotrdg sotrdg
@ 2020-09-14  8:54 ` Florian Weimer
  2020-09-15 19:46 ` Martin Sebor
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2020-09-14  8:54 UTC (permalink / raw)
  To: sotrdg sotrdg via Libc-alpha; +Cc: sotrdg sotrdg

* sotrdg sotrdg via Libc-alpha:

> How does the compiler deal with characters with EBCDIC string
> literals enabled?
>
> How does glibc deal with EBCDIC compiler?

glibc has not been ported to any EBCDIC target, and I doubt it ever
will be ported to an operating systems that's primarily EBCDIC-based.

> 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”?

The implementation is expected to output the character '4' for the
number.  The mechanism used for that is not specified.

In practice, I expect it will eventually converted to ASCII or UTF-8
these days because native EBCDIC terminals are extinct.  But on an
EBCDIC system, the program itself will write EBCDIC, it just gets
translated later.

> How does the filename get dealt with on EBCDIC compilers?

That depends a lot on on the operating system and the file system.
That's not really specific to EBCDIC, it's a fairly complex topic
everywhere (even on Linux, despite its generially lenient pathname
syntax).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about EBCDIC compiler
  2020-09-14  4:36 A question about EBCDIC compiler sotrdg sotrdg
  2020-09-14  8:54 ` Florian Weimer
@ 2020-09-15 19:46 ` Martin Sebor
  2020-09-15 22:00   ` Joseph Myers
  1 sibling, 1 reply; 4+ messages in thread
From: Martin Sebor @ 2020-09-15 19:46 UTC (permalink / raw)
  To: sotrdg sotrdg, libc-alpha

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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A question about EBCDIC compiler
  2020-09-15 19:46 ` Martin Sebor
@ 2020-09-15 22:00   ` Joseph Myers
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2020-09-15 22:00 UTC (permalink / raw)
  To: Martin Sebor; +Cc: sotrdg sotrdg, libc-alpha

On Tue, 15 Sep 2020, Martin Sebor via Libc-alpha wrote:

> 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

That's GCC bug 20110.

C and POSIX don't really work well when different locales have different 
encodings for the basic execution character set.  Any locales that don't 
include the ASCII characters with the same values as in ASCII will not 
work well in glibc.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-15 22:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  4:36 A question about EBCDIC compiler sotrdg sotrdg
2020-09-14  8:54 ` Florian Weimer
2020-09-15 19:46 ` Martin Sebor
2020-09-15 22:00   ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).