#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)

Charles
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Monday, November 03, 2014 1:49 PM
To: [email protected]
Subject: Re: C Language: non-EBCDIC characters in literal strings.

On Mon, 3 Nov 2014 12:08:57 -0800, Charles Mills wrote:

>Would not apply to a #define, right? A #define has no real existence. #define 
>A "foo" simply means "every time you encounter the token A, substitute "foo" 
>instead.
>
>So the operative syntax would be
>
>#define A "foo"
>...
>#pragma convert(codepage)
>char bar[] A;
>#pragma convert(pop)
>
>Right?
> 
Not very right.  It means that if there's a single defining occurrence of A 
(perhaps in a header file) but multiple applied occurrences, each applied 
occurrence must be bracked with convert(codepage) ... convert(pop)

I really wish CPP supported such as:

#define A; \
#pragma convert(codepage); \
"foo" \
#pragma convert(pop);

(like any multi-line macro) so that:

char bar[] A;

would expand to:

char bar[]
#pragma convert(codepage)
"foo"
#pragma convert(pop)
;

I once used a language in which such gyrations were possible: macro expansion 
could generate preprocessor commands.  It was wonderful.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to