Yup and yup. (that's yes and yes in yupese. <G>)
In fact, some platforms don't. Windows, for example, or Linux,
or most Unices. Some platforms don't even use an encoding which
is a superset of ASCII: IBM mainframes use EBCDIC, for example.
All you're guaranteed is that:
-- a certain number of characters (known as the basic character
set) are present,
-- the digits (but not necessarily the upper or lower case
letters) are successive, and in ascending order, and
-- no character in the basic character set will be negative
when stored in a char (but this doesn't hold for characters
in the extended characters set).
In addition, the actual run-time character set can change
depending on the locale. Which can play havoc with e.g. string
literals (which don't appear like they do in the code).
And often isn't, for historical reasons. Even when it is
Unicode, sometimes it's UTF-16, other times UTF-32.
If you compile a C++ program, run it, the system runs your
program in a 'console' (assumed). It's the 'console' that has
the char set, AFAIK.
It's significantly more complicated than that: as you correctly
observer, the "characters" are interpreted by many different
components, some of which are completely independant of your
code: in a string literal, the apparent character will probably
depend on the encoding of the font you use in the editor, when
you write the code. Unless the editor is compensating in some
way---most editors will allow using one encoding for display,
and another when writing to the file. After that, the compiler
might remap some of the characters, according to its ideas as to
what the "default" execution code set is, compared to the code
set it's reading. (At present, I don't think many compilers
actually do this. But it could make a lot of sense for
cross-compilers.) Until this point, of course, we're only
concerned with string literals and character constants. At
runtime, how the program interprets characters internally (i.e.
things like isupper) depends on the current locale; in C++, this
means that it can be different for different files. Once you've
output the character (say 0xE9---a "Latin small letter e with
grave accent" in ISO 8859-1), of course, you have no more
control over how it is interpreted; if you output to the
console, it will depend on the codeset the current console font
is using, which is pretty much out of the control of your
program. (I think Windows calls this a codepage.) If you
output it to a file, and copy the file into a console window
sometime later (the "cat" command under Unix and most advanced
Windows command interpreters, "type" in the default Windows
command interpreter), it will depend on the font being used in
the console window at the time you execute the command. (At
least under X, it's possible to have two different console
windows using different fonts, with different encodings, running
at the same time. So the "character" you see will depend on
which window you look at the file in.) Copy the file to the
printer, of course, and the character will depend on the font
used by the printer.
Think about it. What would a char set be used for? Output to a screen (CRT)?
C++ does not know anything about a screen, keyboard, mouse, filesystem,
etc.. Those are supplied by libraries. Try writing anything[1] in C++
*without* any '#include' in it, and get IO.
The language does define a certain number of includes, including
<iostream> and <fstream>. So there is support for IO in the
language. The semantics, on the other hand, are very, very
loosely defined; more a suggestion of an intent than an actual
definition. Probably because C++ can't affect much of this.