Others may differ, but I think that if in ANY language you code a hex constant then what you asked for is what you get.
I have seen code that, for example, converted character digits to binary by subtracting 0x30. Guess what? Does not work for EBCDIC. I don't think any language converter should presume that 0x30 really means 0xf0, or that \xa0 means anything other than 0xa0. I feel the pain of anyone attempting to port code that has "characters" (in any sense of the word) coded in hex between EBCDIC and ASCII, but I just don't think any compiler should process \xa0 as anything other than 0xa0. If I were porting such code, I might attempt to solve the problem with macros, or by front-ending printf(), or by putting all such character strings in a static array and translating them at startup, or ... Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Paul Gilmartin Sent: Monday, November 03, 2014 4:44 PM To: [email protected] Subject: Re: C Language: non-EBCDIC characters in literal strings. On Mon, 3 Nov 2014 15:49:44 -0800, Charles Mills wrote: >#define A(name) \ >_Pragma ( "convert(codepage)" ) \ >char name[] "foo"; \ >_Pragma ( "convert(pop)" ) > >(untested) is close to what you want. ("You can't always get what you >want." -- Mick Jagger) > I'm unfamilar with the alternative form, "_Pragma" (and a lot of other stuff). But suppose I want to use A in other contexts, such as printf()? Would the following work likewise?: >#define \ >_Pragma ( "convert(codepage)" ) \ > "foo" \ >_Pragma ( "convert(pop)" ) Then either or both of of: char name[] A; printf( "%s/n", A ); And it still leaves the feature (problem?) of not converting octal/hex escape sequences, teeming in ported ASCII source code in which they refer to ASCII code points needing conversion to EBCDIC, not literal EBCDIC code points. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
