473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

C++ Precompiler: Same as C Precompiler?

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

John
Jun 11 '07 #1
22 1883
JohnQ wrote:
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 ?
Jun 11 '07 #2
In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
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.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 11 '07 #3

"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk...
In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
>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.\
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
Jun 11 '07 #4
JohnQ wrote:
"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk...
>In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
>>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.\

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++.

--
Ian Collins.
Jun 11 '07 #5
In article <h5******************@newssvr23.news.prodigy.net >,
jo***********************@yahoo.com says...

[ ... ]
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.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Jun 11 '07 #6

"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk...
In article <h5******************@newssvr23.news.prodigy.net >,
jo***********************@yahoo.com says...

[ ... ]
>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
Jun 11 '07 #7

"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
JohnQ wrote:
>"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk.. .
>>In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
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.\

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++.
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
Jun 11 '07 #8
JohnQ wrote:
"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
>JohnQ wrote:
>>"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk. ..
In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
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.\
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++.

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?

--
Ian Collins.
Jun 11 '07 #9

"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.

--
Cheers,
Robbie Hatley
lonewolf aatt well dott com
triple-dubya dott tustinfreezone dott org
Jun 11 '07 #10

"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
JohnQ wrote:
>"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
>>JohnQ wrote:
"Jerry Coffin" <jc*****@taeus.comwrote in message
news:MP************************@news.sunsite.dk ...
In article <xC*****************@newssvr22.news.prodigy.net> ,
jo***********************@yahoo.com says...
>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.\
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++.

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?
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
Jun 11 '07 #11

"Robbie Hatley" <bo***********@no.spamwrote in message
news:7o*******************@fe10.news.easynews.com. ..
>
"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"?
Yes, that's exactly what I meant. My bad.

John
Jun 11 '07 #12
JohnQ wrote:
"Ian Collins" <ia******@hotmail.comwrote:
>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.
Then you are not talking about a "precompiler".

--
Ian Collins.
Jun 11 '07 #13
On Jun 11, 2:24 am, "JohnQ" <johnqREMOVETHISprogram...@yahoo.com>
wrote:
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 11 '07 #14

"James Kanze" <ja*********@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
On Jun 11, 2:24 am, "JohnQ" <johnqREMOVETHISprogram...@yahoo.com>
wrote:
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
Jun 11 '07 #15

"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
JohnQ wrote:
>"Ian Collins" <ia******@hotmail.comwrote:
>>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.
Then you are not talking about a "precompiler".
I know, it was "a typo". 'preprocessor' is what I meant.

John
Jun 11 '07 #16
JohnQ wrote:
>
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.

--
Ian Collins.
Jun 11 '07 #17

"Ian Collins" <ia******@hotmail.comwrote in message
news:5d**************@mid.individual.net...
JohnQ wrote:
>>
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.
Explain/prove please.

John
Jun 12 '07 #18
JohnQ wrote:
"Ian Collins" <ia******@hotmail.comwrote in message
news:5d**************@mid.individual.net...
>JohnQ wrote:
>>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.

Explain/prove please.
Oh come on, have you read an C++ books?

--
Ian Collins.
Jun 12 '07 #19

"Ian Collins" <ia******@hotmail.comwrote in message
news:5d*************@mid.individual.net...
JohnQ wrote:
>"Ian Collins" <ia******@hotmail.comwrote in message
news:5d**************@mid.individual.net...
>>JohnQ wrote:
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.

Explain/prove please.
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
Jun 12 '07 #20
On Jun 12, 1:48 am, "JohnQ" <johnqREMOVETHISprogram...@yahoo.com>
wrote:
"James Kanze" <james.ka...@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
On Jun 11, 2:24 am, "JohnQ" <johnqREMOVETHISprogram...@yahoo.com>
wrote:
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?
Well, how anything is implemented is implementation-specific,
but yes, templates have nothing to do with the preprocessor;
they are defined at the language level (phases 7 and later), and
normally implemented at that level as well.

How could it be otherwise, given the rules for e.g. name
binding, scope, etc.?
(Aside: Your post's header info contains:
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable <<-- Is this the problem?)
I suspect so; there's no reason for it to be there. On the
other hand, I don't know where it is getting introduced. (Maybe
the firewall here? It's not present when I don't post behind a
firewall.)

--
James Kanze (GABI Software, from CAI) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 12 '07 #21
On Jun 12, 1:52 am, Ian Collins <ian-n...@hotmail.comwrote:
JohnQ wrote:
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.
They have scope, which the preprocessor doesn't. They
participate in function overloading, which the preprocessor
doesn't. Etc., etc.

The question is really a little ridiculous, I think. Even a
superficial glance shows that templates are integrated into the
language. Traditionally, CFront implemented them at the linker
stage, using a pre-linker. Well after preprocessing.

Of course, it's possible to simulate some of the functionality
of templates using the preprocessor; I can still remember using
<generic.h>. But it's very definitly a simulation, using text
based substitution, and not real templates (which operate on
language entities, and not text). Thus, for example, given:

typedef int A ;
typedef int B ;

instantiating a class defined using <generic.hon A and on B
would result in two distinct instantiations, since the names
differed textually, whereas there will only be one template
instantiation, since the types are identical. And it was
impossible to instantiate a class defined using <generic.hon a
nested class, since the textual name, Outer::Inner couldn't be
pasted to make a valid class name.

--
James Kanze (GABI Software, from CAI) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Jun 12 '07 #22

"James Kanze" <ja*********@gmail.comwrote in message
news:11**********************@r19g2000prf.googlegr oups.com...
On Jun 12, 1:52 am, Ian Collins <ian-n...@hotmail.comwrote:
JohnQ wrote:
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.
"They have scope, which the preprocessor doesn't. They
participate in function overloading, which the preprocessor
doesn't. Etc., etc.

The question is really a little ridiculous, I think. Even a
superficial glance shows that templates are integrated into the
language. Traditionally, CFront implemented them at the linker
stage, using a pre-linker. Well after preprocessing.

Of course, it's possible to simulate some of the functionality
of templates using the preprocessor; I can still remember using
<generic.h>. But it's very definitly a simulation, using text
based substitution, and not real templates (which operate on
language entities, and not text)."

To me, "real" templates are the concept and not the C++-specific
incarnation.

"Thus, for example, given:

typedef int A ;
typedef int B ;

instantiating a class defined using <generic.hon A and on B
would result in two distinct instantiations, since the names
differed textually, whereas there will only be one template
instantiation, since the types are identical. "

Yep, that's true, but hardly a deal breaker.

" And it was
impossible to instantiate a class defined using <generic.hon a
nested class, since the textual name, Outer::Inner couldn't be
pasted to make a valid class name."

Do you have an example?

John
Jun 12 '07 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Carlos De Matos | last post by:
Hello all, Has anyone written a project/code/document on a possible implementation for a c# precompiler? I want to build a precompiler that will modify attributed code, then submit the...
8
by: Bill Pursell | last post by:
This question must be FAQ, but I can't find it: I'm baffled by the following: $ cat a.c #define foo(x) foo##x_ #define bar(x) bar##x##_ foo() foo(1) bar()
10
by: RainerF | last post by:
Hi Folks, My Problem is: My SQL Statement Structure: SELECT TABLEA.FIELDA, TABLEA.FIELDB, TABLEA.FIELDC, TABLEA.FIELDD,
104
by: JohnQ | last post by:
Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing? I have a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.