Re: compiling C++ to C, was writing a compiler

Barry Kelly <barry.j.kelly@gmail.com>
Wed, 05 Nov 2008 07:46:04 +0000

          From comp.compilers

Related articles
[4 earlier articles]
Re: Writing a compiler lkrupp@pssw.nospam.com.invalid (Louis Krupp) (2008-11-01)
Re: Writing a compiler marcov@stack.nl (Marco van de Voort) (2008-11-02)
Re: Writing a compiler lkrupp@pssw.com (Louis Krupp) (2008-11-03)
Re: Writing a compiler alexc@TheWorld.com (Alex Colvin) (2008-11-03)
Re: compiling C++ to C, was writing a compiler marcov@stack.nl (Marco van de Voort) (2008-11-04)
Re: compiling C++ to C, was writing a compiler alexc@TheWorld.com (Alex Colvin) (2008-11-04)
Re: compiling C++ to C, was writing a compiler barry.j.kelly@gmail.com (Barry Kelly) (2008-11-05)
Re: compiling C++ to C, was writing a compiler lkrupp@pssw.nospam.com.invalid (Louis Krupp) (2008-11-05)
| List of all articles for this month |

From: Barry Kelly <barry.j.kelly@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 05 Nov 2008 07:46:04 +0000
Organization: Compilers Central
References: 08-10-037 08-10-046 08-10-047 08-11-003 08-11-008 08-11-009 08-11-014 08-11-015 08-11-019
Keywords: C++
Posted-Date: 05 Nov 2008 18:49:08 EST
X-DF-Seen-By: ms

Marco van de Voort wrote:


> On 2008-11-03, Alex Colvin <alexc@TheWorld.com> wrote:


> > Runtime and linker features such as exceptions and template instantiation
> > would be very difficult to generate in C.


> Exceptions are harder. Sure, it is doable in C, but would the resulting,
> stack unwinding C be portable to a different compiler (IOW free of (ab)use of
> specific ABI knowledge )?


I've implemented Windows SEH-style exception handling (try / except /
finally) using C setjmp and longjmp, and I'm sure I'm not alone. C++ EH
can be built on top of that.


It's not particularly pretty, but it's portable in so far as setjmp and
longjmp are portable, if you e.g. discard register attributes for locals
etc.


-- Barry


--
http://barrkel.blogspot.com/



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.