Andreas Lundgren <> writes:
> Is it determined that the C standard compiler always encode characters
> with the same character excoding? If for example the functions Foo and
> Bar are compiled by different compilers, is it unambiguous how to
> interpret the character string in Bar?
>
> Does string.h expect a specific string format?
>
> void Foo(void)
> {
> char myTextString[11] = "stuvxyzåäö";
> Bar(myTextString);
> }
>
> void Bar(char* inp)
> {
> What character set to expect?
> }
No.
But if the two compilers are being used on the same system, it's very
likely that they'll use the same encoding. Since you're calling one
function from the other, presumably you're using the compilers on the
same system and linking the resulting code into a single executable or
equivalent.
Typically a given operating system will impose representations for
certain things. Though this is outside the scope of the C standard,
it's in the best interest of compiler writers to make their generate
code work and play well with that of other compilers. (For example, a
C compiler for Linux that generates code that's incompatible with code
generated by gcc wouldn't be very useful.)
This goes far beyond character set issues and includes things like
integer and floating-point type representations and function calling
conventions.
Your later followup suggests that you're concerned about some
real-world situation, presumably on some specific system. You should
ask in a newsgroup that deals with that system.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"