Passing a Method Name to a Method, Redux

M

Martin Gregorie

I did not want a C compiler. I simply wanted a preprocessor.
The last C compilers I remember that had separate preprocessors were K&R,
so were very old. In these, cc was effectively a shell that invoked the
preprocessor, the C --> assembler translator, the assembler and the
linker in turn. Actually, I'm still using one - the standard OS/9 v2.4 C
compiler, which dates from 1992 and runs on 68xxx hardware.

I don't remember any ANSI C compilers I've used being structured this
way: certainly I've not seen any version of the GNU compiler or its
derivatives that aren't a monolithic chunk that includes all compilation
stages except the linker. AFAICR this also applied to the Borland
compilers.

So, if that's really what you want, go and find a old K&R compiler or its
source.
 
A

Arne Vajhøj

The last C compilers I remember that had separate preprocessors were K&R,
so were very old. In these, cc was effectively a shell that invoked the
preprocessor, the C --> assembler translator, the assembler and the
linker in turn. Actually, I'm still using one - the standard OS/9 v2.4 C
compiler, which dates from 1992 and runs on 68xxx hardware.

I don't remember any ANSI C compilers I've used being structured this
way: certainly I've not seen any version of the GNU compiler or its
derivatives that aren't a monolithic chunk that includes all compilation
stages except the linker. AFAICR this also applied to the Borland
compilers.

So, if that's really what you want, go and find a old K&R compiler or its
source.

GCC still has a separate executable for preprocessing!

The driver gcc or g++ calls cpp, cc1 or cc1plus, as and ld.

Arne
 
L

lewbloch

GCC still has a separate executable for preprocessing!

The driver gcc or g++ calls cpp, cc1 or cc1plus, as and ld.

<http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Preprocessor-
Options.html#Preprocessor-Options>
"If you use the -E option, nothing is done except preprocessing. Some
of these options make sense only together with -E because they cause
the preprocessor output to be unsuitable for actual compilation."

Ain't the FM (of "RTFM") a marvel? Amazing what one can learn by
reading the documentation!

For example, I found out just now that there's a GCC Go!
<http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Standards.html#Standards>
§2.4
<http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gccgo/>

I had not known that.
 
M

Martin Gregorie

On 7/23/2011 9:19 AM, Martin Gregorie wrote:

GCC still has a separate executable for preprocessing!

The driver gcc or g++ calls cpp, cc1 or cc1plus, as and ld.
Fair cop, guv.

I looked at /usr/bin, thought the preprocessor was called cpre so didn't
find it and glanced through 'man gcc' but didn't find anything describing
the compiler structure. The fact that the options are subdivided onto
compilation stages doesn't necessarily say anything about the compiler
physical structure, and as gcc is fairly big, I assumed....
 
A

Arne Vajhøj

<http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Preprocessor-
Options.html#Preprocessor-Options>
"If you use the -E option, nothing is done except preprocessing. Some
of these options make sense only together with -E because they cause
the preprocessor output to be unsuitable for actual compilation."

Ain't the FM (of "RTFM") a marvel? Amazing what one can learn by
reading the documentation!

Is is great reading the FM.

In this case the FM (at least not in what you quote) does not cover
the topic of discussion - whether it is a monolithic executable
or a series of executables.

Arne
 
L

lewbloch

Is is great reading the FM.

In this case the FM (at least not in what you quote) does not cover
the topic of discussion - whether it is a monolithic executable
or a series of executables.

A difference that makes no difference is no difference.
 
L

lewbloch

lewbloch said:
A difference that makes no difference is no difference.

But for completeness:

http://gcc.gnu.org/onlinedocs/cpp/index.html#Top
"The C preprocessor implements the macro language used to transform C,
C++, and Objective-C programs before they are compiled. It can also be
useful on its own."

http://gcc.gnu.org/onlinedocs/cpp/Overview.html#Overview
"The C preprocessor, often known as cpp, is a macro processor that is
used automatically by the C compiler to transform your program before
compilation."

From the bash shell:

$ which cpp
/usr/bin/cpp
$ ls -l /usr/bin/cpp
lrwxrwxrwx 1 root root 7 May 31 12:37 /usr/bin/cpp -> cpp-4.4
$ ls -l /usr/bin/cpp-4.4
-rwxr-xr-x 1 root root 255192 Mar 26 2010 /usr/bin/cpp-4.4

This can be learned from reading the frakkin' manual as suggested!
Does everyone have to be spoonfed everything?

The idea here is to follow the general principle, e.g., RTFM!, so that
one can be independently brilliant. Just because I only led you to
the door and didn't open it and spread roses in your path doesn't make
my advice bad. I anticipate that any real programmer will take the
hint and do their own homework, once shown where they can look.

For example, the poster who whined about wanting a standalone
preprocessor could have easily looked up those links posted here,
given the hint that it was at least possible that the indicated
documentation would yield that data. For that matter, so could you
have. It would have been far more helpful for you to post the
additional data to help that whiner than to speciously complain that I
didn't. Don't you want to be helpful?

But in the end, monolithic or separate, they get the ability to run
the preprocessor on its own EVEN WERE IT PART OF A MONOLITHIC
PROGRAM! Why wouldn't that suit, hm?

So let's fry that red herring and eat it, not proffer it as some sort
of valid counterargument.

RTFM!
 
A

Arne Vajhøj

A difference that makes no difference is no difference.

It has no impact on the OP's problem, but there was a little
side discussion on the GCC implementation.

Arne
 
A

Arne Vajhøj

But for completeness:

[links to cpp docs]
This can be learned from reading the frakkin' manual as suggested!
Does everyone have to be spoonfed everything?

The idea here is to follow the general principle, e.g., RTFM!, so that
one can be independently brilliant. Just because I only led you to
the door and didn't open it and spread roses in your path doesn't make
my advice bad. I anticipate that any real programmer will take the
hint and do their own homework, once shown where they can look.

For example, the poster who whined about wanting a standalone
preprocessor could have easily looked up those links posted here,
given the hint that it was at least possible that the indicated
documentation would yield that data. For that matter, so could you
have. It would have been far more helpful for you to post the
additional data to help that whiner than to speciously complain that I
didn't. Don't you want to be helpful?

But in the end, monolithic or separate, they get the ability to run
the preprocessor on its own EVEN WERE IT PART OF A MONOLITHIC
PROGRAM! Why wouldn't that suit, hm?

Hm.

This little subthread is not about the OP's problem, but about
whether GCC is monolitic.

Just saying RTFM is fine.

Saying RTFM and providing relevant information from the FM for
the discussion is fine.

I can not really see any point in saying RTFM and providing
irrelevant information from the FM.

And I don't think that is requiring to be spoonfed.

Arne
 
A

Arne Vajhøj

Fair cop, guv.

I looked at /usr/bin, thought the preprocessor was called cpre so didn't
find it and glanced through 'man gcc' but didn't find anything describing
the compiler structure. The fact that the options are subdivided onto
compilation stages doesn't necessarily say anything about the compiler
physical structure, and as gcc is fairly big, I assumed....

It is cpp (or gcc-cpp).

Not a very good name - most would assume that cpp=c plus plus.

But then most people would call it via the general compiler driver, so
it does not matter much.

Arne
 
M

Martin Gregorie

It is cpp (or gcc-cpp).

Not a very good name - most would assume that cpp=c plus plus.

But then most people would call it via the general compiler driver, so
it does not matter much.
I looked for cpre since I thought that was what the preprocessor was
called in Microware's K&R compiler. I just ran the compiler up to check
(its been a long time since I compiled C on that machine) and found it
too calls it cpp. A visible difference between gcc and the OS/9 compiler
(cc) is that the latter displays the name and arguments of each compiler
phase as it is executed: its quite a nice thing to do on a slow machine
(25 MHz 68020).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top