This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR18785: Support non-native execution charsets


On Wed, 22 Dec 2004, Joseph S. Myers wrote:
> On Wed, 22 Dec 2004, Roger Sayle wrote:
> > The '%' character is 108 (0x6c) in EBCDIC and 37 (0x25) in ASCII.  How
> > do you propose going about checking format strings such as %s in
> > non-native character sets, if we can't recognize them at compile-time?
>
> Use iconv (probably encapsulated in cpplib, as the present use for
> translating from source to execution character sets is) on all the
> presently hardcoded characters in the source.  Add appropriate interfaces
> as necessary to deal with advancing both a single (possibly multibyte)
> character, or a single byte, in a format string, as we need to do in
> different circumstances.
>
> > Similarly, the result of strcmp("*","+") > 0 is different on ASCII
> > targets than it is on EBCDIC targets.  Evaluating this at compile-time
> > in a nonnative environment is clearly wrong.
>
> The result of strcmp depends on the unsigned char byte values in the
> string.  We know what bytes (in the -fexec-charset encoding) are going in
> the object file for those strings: we compare them as unsigned char to
> determine the result of strcmp.

We are still talking about the review in which you wrote
"I think a conservative patch should only..."?

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]