Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-24-2010, 02:42 AM
|
#1
|
Member
Registered: Jun 2006
Location: Beijing
Posts: 60
Rep:
|
-fexec-charset for preprocessor or for c compiler?
Hi
I'm reading about GNU CPP(GNU C preprocessor). In the CPP manual -> 1.1 Character sets:
Code:
After preprocessing is complete, string and character constants are converted again, into the execution character set.
This character set is under control of the user; the default is UTF-8, matching the source character set.
I think "under control of the user" means to use the option -fexec-charset=, right? And in the above part, it says pretty clear: "After preprocessing is complete", so the job -- "string and character constants are converted again, into the execution character set" -- should be done by the C compiler(compilation proper), not GNU CPP. Then the option -fexec-charset= should be an option controlling the C compiler, not the preprocessor. But in the GCC manual, this option is listed in the "3.11 Options Controlling the Preprocessor". I don't understand this, If this option is an option controlling the preprocessor, it conflicts with the CPP manual. How to understand this?
THANKS!!
|
|
|
12-28-2010, 10:28 AM
|
#2
|
Member
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205
Rep:
|
Quote:
Originally Posted by password636
I think "under control of the user" means to use the option -fexec-charset=, right?
|
Yes.
Quote:
Originally Posted by password636
And in the above part, it says pretty clear: "After preprocessing is complete", so the job -- "string and character constants are converted again, into the execution character set" -- should be done by the C compiler(compilation proper), not GNU CPP. Then the option -fexec-charset= should be an option controlling the C compiler, not the preprocessor. But in the GCC manual, this option is listed in the "3.11 Options Controlling the Preprocessor". I don't understand this, If this option is an option controlling the preprocessor, it conflicts with the CPP manual. How to understand this?
|
The GNU compiler does not use a separate preprocessor, but the preprocessor is integrated into the compiler. In GCC, the translation takes part in the preprocessor component (from a source tree perspective), but as part of the compilation process.
|
|
|
12-28-2010, 08:58 PM
|
#3
|
Member
Registered: Jun 2006
Location: Beijing
Posts: 60
Original Poster
Rep:
|
Quote:
Originally Posted by ForzaItalia2006
In GCC, the translation takes part in the preprocessor component (from a source tree perspective), but as part of the compilation process.
|
I don't get it. I knew that a rough definition of compilation started from preprocessing and ended after linking. GCC manual says "Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order." The manual distinguished preprocessing and compilation proper conceptually, so when it says "options controlling the preprocessor" it means the option is used for preprocessing (first of the four stages). That's what I don't understand because I think -fexec-charset= should be "options controlling the compilation proper". You can say compilation in a rough definition, but the manual doesn't seem to mean that.
|
|
|
12-30-2010, 12:32 PM
|
#4
|
Member
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205
Rep:
|
Quote:
Originally Posted by password636
I don't get it. I knew that a rough definition of compilation started from preprocessing and ended after linking. GCC manual says "Compilation can involve up to four stages: preprocessing, compilation proper, assembly and linking, always in that order." The manual distinguished preprocessing and compilation proper conceptually, so when it says "options controlling the preprocessor" it means the option is used for preprocessing (first of the four stages). That's what I don't understand because I think -fexec-charset= should be "options controlling the compilation proper". You can say compilation in a rough definition, but the manual doesn't seem
to mean that.
|
Yes,that is true. Logically, Gcc distinguishes 4 phases, but preprocessing and compilationq proper are merged into a single phase. The c standard doesn't clearly say where the conversion belongs to. The wording in the Gcc docu might be misleading and - I don't think it is important - but the whole conversion stuff in Gcc is implemented in libcpp (preprocessing library). But the conversion only takes place during compilation prop. So the docu lists this option under preprocessing because this is implemented in the preprocessor.
I hope it's clearer now?
Andi
|
|
1 members found this post helpful.
|
12-30-2010, 11:41 PM
|
#5
|
Member
Registered: Jun 2006
Location: Beijing
Posts: 60
Original Poster
Rep:
|
Quote:
Originally Posted by ForzaItalia2006
Yes,that is true. Logically, Gcc distinguishes 4 phases, but preprocessing and compilationq proper are merged into a single phase. The c standard doesn't clearly say where the conversion belongs to. The wording in the Gcc docu might be misleading and - I don't think it is important - but the whole conversion stuff in Gcc is implemented in libcpp (preprocessing library). But the conversion only takes place during compilation prop. So the docu lists this option under preprocessing because this is implemented in the preprocessor.
I hope it's clearer now?
Andi
|
I see. The conversion code is in the cpp library but is invoked during compilation proper phase. Then I think maybe GCC manual should put it in other section like "options controlling compilaton proper", alternatively, the writers should put your reply into the manual as a footnote. Can save me days...
|
|
|
All times are GMT -5. The time now is 12:28 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|