public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* front-end that translate C++ to C
@ 2005-07-25  2:26 Yi-kwon Hwang
  2005-07-25 10:02 ` Vladimir A. Merzliakov
  0 siblings, 1 reply; 6+ messages in thread
From: Yi-kwon Hwang @ 2005-07-25  2:26 UTC (permalink / raw)
  To: gcc

Hi all,

Are there any open-source(or free) front-end which translates C++ to C?
I could find some commercial things - Comeau, AT&T Cfront, etc., but
these have many limitations(especially, It's too difficult to get cfront
because there are few cfront-based compiler at present)


Cheers,

-- 
Yi-kwon Hwang


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: front-end that translate C++ to C
  2005-07-25  2:26 front-end that translate C++ to C Yi-kwon Hwang
@ 2005-07-25 10:02 ` Vladimir A. Merzliakov
  2005-07-25 17:43   ` Daniel Berlin
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir A. Merzliakov @ 2005-07-25 10:02 UTC (permalink / raw)
  To: Yi-kwon Hwang, gcc

> Hi all,
> 
> Are there any open-source(or free) front-end which translates C++ to C?
> I could find some commercial things - Comeau, AT&T Cfront, etc., but
> these have many limitations(especially, It's too difficult to get cfront
> because there are few cfront-based compiler at present)
LLVM ( http://llvm.cs.uiuc.edu/ ) ? 

It use modified gcc 3.4 as C/C++ frontend and it can emits portable C code.

Vladimir

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: front-end that translate C++ to C
  2005-07-25 10:02 ` Vladimir A. Merzliakov
@ 2005-07-25 17:43   ` Daniel Berlin
  2005-07-25 19:00     ` Tom Tromey
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Berlin @ 2005-07-25 17:43 UTC (permalink / raw)
  To: Vladimir A. Merzliakov; +Cc: Chris Lattner, Yi-kwon Hwang, gcc

On Mon, 2005-07-25 at 14:01 +0400, Vladimir A. Merzliakov wrote:
> > Hi all,
> > 
> > Are there any open-source(or free) front-end which translates C++ to C?
> > I could find some commercial things - Comeau, AT&T Cfront, etc., but
> > these have many limitations(especially, It's too difficult to get cfront
> > because there are few cfront-based compiler at present)
> LLVM ( http://llvm.cs.uiuc.edu/ ) ? 
> 
> It use modified gcc 3.4 as C/C++ frontend and it can emits portable C code.
Depends what you mean by portable.
You can't take the output of the gcc llvm frontend on one platform, and
run it on another, like cfront could.

The sizes, alignments, etc, of things will be different, where people
use sizeof(x), etc, in their code.


Unless you hacked up the C frontend to give you sizeof_expr, etc.

Chris?

--Dan




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: front-end that translate C++ to C
  2005-07-25 17:43   ` Daniel Berlin
@ 2005-07-25 19:00     ` Tom Tromey
  2005-07-25 20:29     ` Chris Lattner
  2005-07-25 20:29     ` Vladimir A. Merzliakov
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2005-07-25 19:00 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Chris Lattner, Yi-kwon Hwang, gcc

>>>>> "Dan" == Daniel Berlin <dberlin@dberlin.org> writes:

Dan> You can't take the output of the gcc llvm frontend on one platform, and
Dan> run it on another, like cfront could.

Dan> The sizes, alignments, etc, of things will be different, where people
Dan> use sizeof(x), etc, in their code.

Dan> Unless you hacked up the C frontend to give you sizeof_expr, etc.

Even then you would run into '#if WORDS_BIGENDIAN' and the like...

Tom

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: front-end that translate C++ to C
  2005-07-25 17:43   ` Daniel Berlin
  2005-07-25 19:00     ` Tom Tromey
@ 2005-07-25 20:29     ` Chris Lattner
  2005-07-25 20:29     ` Vladimir A. Merzliakov
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Lattner @ 2005-07-25 20:29 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Vladimir A. Merzliakov, Yi-kwon Hwang, gcc

On Mon, 25 Jul 2005, Daniel Berlin wrote:
> On Mon, 2005-07-25 at 14:01 +0400, Vladimir A. Merzliakov wrote:
>>> Hi all,
>>> Are there any open-source(or free) front-end which translates C++ to C?
>>> I could find some commercial things - Comeau, AT&T Cfront, etc., but
>>> these have many limitations(especially, It's too difficult to get cfront
>>> because there are few cfront-based compiler at present)
>> LLVM ( http://llvm.cs.uiuc.edu/ ) ?
>>
>> It use modified gcc 3.4 as C/C++ frontend and it can emits portable C code.

> Depends what you mean by portable.
> You can't take the output of the gcc llvm frontend on one platform, and
> run it on another, like cfront could.
>
> The sizes, alignments, etc, of things will be different, where people 
> use sizeof(x), etc, in their code. Unless you hacked up the C frontend 
> to give you sizeof_expr, etc.

It isn't portable in that sense.  Like Tom Tromey mentions, anything that 
deals with code that comes out of the preprocessor isn't "portable" in 
that way.

It is portable in the sense of being able to use any standard ANSI C 
compiler to compile the code, which gives you a pretty portable C++ 
implementation.  We have had quite a few people say they are using LLVM as 
a replacement for old and out-dated CFront-based vendor C++ front-ends.

Using LLVM in this way allows them to use the GCC 3.4 parser and libstdc++ 
which is usually far better than what they are dealing with.  Getting IPO 
and the other advantages that LLVM provides is just a perk that people 
with embedded devices (or other systems with constrained resources) 
particularly enjoy.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: front-end that translate C++ to C
  2005-07-25 17:43   ` Daniel Berlin
  2005-07-25 19:00     ` Tom Tromey
  2005-07-25 20:29     ` Chris Lattner
@ 2005-07-25 20:29     ` Vladimir A. Merzliakov
  2 siblings, 0 replies; 6+ messages in thread
From: Vladimir A. Merzliakov @ 2005-07-25 20:29 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: gcc

>> LLVM ( http://llvm.cs.uiuc.edu/ ) ?
>>
>> It use modified gcc 3.4 as C/C++ frontend and it can emits portable C 
>> code.
> Depends what you mean by portable.
> You can't take the output of the gcc llvm frontend on one platform, and
> run it on another, like cfront could.
"emits portable C code" just copied from "LLVM Overview" at 
http://llvm.cs.uiuc.edu/ :)

Vladimir 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-07-25 20:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25  2:26 front-end that translate C++ to C Yi-kwon Hwang
2005-07-25 10:02 ` Vladimir A. Merzliakov
2005-07-25 17:43   ` Daniel Berlin
2005-07-25 19:00     ` Tom Tromey
2005-07-25 20:29     ` Chris Lattner
2005-07-25 20:29     ` Vladimir A. Merzliakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).