LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 12-24-2010, 02:42 AM   #1
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Rep: Reputation: 1
-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!!
 
Old 12-28-2010, 10:28 AM   #2
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by password636 View Post
I think "under control of the user" means to use the option -fexec-charset=, right?
Yes.

Quote:
Originally Posted by password636 View Post
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.
 
Old 12-28-2010, 08:58 PM   #3
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by ForzaItalia2006 View Post
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.
 
Old 12-30-2010, 12:32 PM   #4
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
Quote:
Originally Posted by password636 View Post
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.
Old 12-30-2010, 11:41 PM   #5
password636
Member
 
Registered: Jun 2006
Location: Beijing
Posts: 60

Original Poster
Rep: Reputation: 1
Smile

Quote:
Originally Posted by ForzaItalia2006 View Post
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...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
checking for C compiler default output... configure: error: C compiler cannot create clubbing80s Linux - Software 3 07-05-2010 08:17 PM
checking for C compiler default output... configure: error: C compiler cannot create fiorejm Linux - Software 6 11-12-2009 12:35 PM
Basic C++ compiler/preprocessor question: how to include file as data? tomva Programming 7 08-25-2008 01:16 PM
C pre-preprocessor or preprocessor replacement Tischbein Programming 3 02-11-2007 11:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration