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]

Re: Merge cpplib and front end hashtables, part 1


On 17-May-2001, Neil Booth <neil@daikokuya.demon.co.uk> wrote:
> I don't understand how the user is going to communicate the encoding
> of a file to us.  My understanding is charset encoding is on a
> per-file basis; i.e. there is only one encoding per file.

Allowing multiple encodings per source file would not be a good idea,
I agree.

> But since some header files are system header files, clearly the whole
> translation unit cannot be in a single charset.

Agreed.

> So we need a way to specify it on a per-file basis, presumably in the
> file itself.

Here I disagree on two counts.

Firstly, I think in most cases it would be more convenient to
specify it on a per-directory basis rather than a per-file basis.

Secondly, there is a serious drawback to specifying the encoding in the
file itself, e.g. via a pragma.  The problem arises because files can
be transformed by various tools that understand multibyte encodings
but which don't understand C or GNU C syntax.  If the file encoding
is hard-coded inside the file in a pragma, then those tools would change
the encoding but leave the pragma (or other annotation) unchanged and
hence incorrect.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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