C++ Precompiler: Same as C Precompiler?

J

JohnQ

Is the C++ precompiler the same as a C precompiler? If not, how much
different is it?

John
 
G

Gianni Mariani

JohnQ said:
Is the C++ precompiler the same as a C precompiler? If not, how much
different is it?

I wonder if :

#define ABC( A, B )

ABC( std::map<T1,T2>, B )

is supposed to work in future C++ standard pre processors ?
 
J

Jerry Coffin

Is the C++ precompiler the same as a C precompiler? If not, how much
different is it?

At least officially, they're currently different -- C99 added variadic
macros (for one example) that C++ doesn't have (yet). I believe the
intent is to add these in C++ 0x so they'll be the same again.
 
J

JohnQ

Jerry Coffin said:
At least officially, they're currently different -- C99 added variadic
macros (for one example) that C++ doesn't have (yet). I believe the
intent is to add these in C++ 0x so they'll be the same again.\

Oh! So the C precompiler is "more advanced" then the C++ one. I kinda like
that response. I hope the implication is a correct one.

John
 
I

Ian Collins

JohnQ said:
Oh! So the C precompiler is "more advanced" then the C++ one. I kinda like
that response. I hope the implication is a correct one.
Preprocessor.

Don't forget that a) C99 isn't fully implemented by most C compilers and
b) variadic macros are of more use in C than they are in C++.
 
J

Jerry Coffin

[ ... ]
Oh! So the C precompiler is "more advanced" then the C++ one. I kinda like
that response. I hope the implication is a correct one.

Keep in mind that I said "officially". I said it for a reason --
conforming implementations of C99 are pretty rare, and the only one of
which I'm aware (Comeau) also allows you to use the new preprocessor
when compiling C++ code if you want to; from a practical viewpoint,
there's not a whole lot of difference.

That said, yes, the C preprocessor is currently more advanced than the
C++ preprocessor.
 
J

JohnQ

Jerry Coffin said:
[ ... ]
Oh! So the C precompiler is "more advanced" then the C++ one. I kinda
like
that response. I hope the implication is a correct one.

Keep in mind that I said "officially". I said it for a reason --
conforming implementations of C99 are pretty rare, and the only one of
which I'm aware (Comeau) also allows you to use the new preprocessor
when compiling C++ code if you want to; from a practical viewpoint,
there's not a whole lot of difference.

That said, yes, the C preprocessor is currently more advanced than the
C++ preprocessor.

Ha! My thought was in hacking an existing precompiler (HP PCC, yeah way back
there), and replacing the one that came with VC++ maybe to harness the
templates concept to my liking?

John
 
J

JohnQ

Ian Collins said:
Preprocessor.

Don't forget that a) C99 isn't fully implemented by most C compilers and
b) variadic macros are of more use in C than they are in C++.

Aside: I'm not worried about variadic macros. The only thing I'm "worried
about" is the C++ precompiler supporting C++isms (of only any that I use, of
course).

John
 
I

Ian Collins

JohnQ said:
Aside: I'm not worried about variadic macros. The only thing I'm "worried
about" is the C++ precompiler supporting C++isms (of only any that I use, of
course).
Are you talking about some specific "precompiler" (if so, which?), or
the C++ preprocessor?
 
R

Robbie Hatley

"JohnQ" asked:
Is the C++ precompiler the same as a C precompiler?
If not, how much different is it?

There is no such thing as a "precompiler" in C or C++.
They are not "JIT" languages. Are you a Java programmer,
by any chance?

Or perhaps you mean the "preprocessor"? That is just a text
editor. It is not *any* kind of "compiler", pre-, post-,
or otherwise. It just edits text. No more, no less.

And yes, as far as I can tell, it's pretty much the same
for C and C++. There may be minor differences. Buy and
read the C and C++ standards, if you want the gory details:

http://webstore.ansi.org/ansidocstore/

They're cheap (at least, the electronic versions are)
and they answer many questions.
 
J

JohnQ

Ian Collins said:
Are you talking about some specific "precompiler" (if so, which?), or
the C++ preprocessor?

The C++ one. I'm using VC++ but I recently found HP PCC and am wondering if
I can get some freedom via that.

John
 
J

JohnQ

Robbie Hatley said:
"JohnQ" asked:


There is no such thing as a "precompiler" in C or C++.
They are not "JIT" languages. Are you a Java programmer,
by any chance?

Or perhaps you mean the "preprocessor"?

Yes, that's exactly what I meant. My bad.

John
 
I

Ian Collins

JohnQ said:
The C++ one. I'm using VC++ but I recently found HP PCC and am wondering if
I can get some freedom via that.
Then you are not talking about a "precompiler".
 
J

James Kanze

Is the C++ precompiler the same as a C precompiler?

No, but I think it will be with the next release of the
standard. There is a very extensive common subset, however.
If not, how much different is it?

C++ doesn't have any of the features what were added in C99.
Things like a variable number of arguments for macros.

There are also small differences with regards to predefined
symbols: C doesn't (and won't) have __cplusplus, for example.
This is intentional.
 
J

JohnQ

Is the C++ precompiler the same as a C precompiler?

"No, but I think it will be with the next release of the
standard. There is a very extensive common subset, however."
If not, how much different is it?

"C++ doesn't have any of the features what were added in C99.
Things like a variable number of arguments for macros.

There are also small differences with regards to predefined
symbols: C doesn't (and won't) have __cplusplus, for example.
This is intentional."


So templates are implemented strictly in the compiler then or is that
implementation-specific?


(Aside: Your post's header info contains:
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable <<-- Is this the problem?)

John
 
I

Ian Collins

JohnQ said:
So templates are implemented strictly in the compiler then or is that
implementation-specific?
They have to be implemented by the compiler. Templates use types and
the preprocessor being a simple text processor has no concept to type.
 
J

JohnQ

Ian Collins said:
They have to be implemented by the compiler. Templates use types and
the preprocessor being a simple text processor has no concept to type.

Explain/prove please.

John
 
J

JohnQ

Ian Collins said:
Oh come on, have you read an C++ books?

See my example in one of my latest post in the thread "Re: Are C++ templates
a precompiler thing?" and tell me how it is not type safe. (slink example).
Continue dialog there rather than here unless you can prove what you said
above and want to follow up on that here. Thanks.

John
 

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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top