Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8473

Re: Is there any software porting C++ to C?

From Victor Bazarov <v.bazarov@comcast.invalid>
Newsgroups comp.lang.c++
Subject Re: Is there any software porting C++ to C?
Date 2011-08-04 13:53 -0400
Organization A noiseless patient Spider
Message-ID <j1ema2$feg$1@dont-email.me> (permalink)
References <xxsZp.48094$T85.36355@newsfe19.ams2> <49572b2b-49fc-4cd7-9d97-c6891c20d2ef@t38g2000prj.googlegroups.com> <4e3ad745$0$4151$6e1ede2f@read.cnntp.org>

Show all headers | View raw


On 8/4/2011 1:30 PM, Philipp Klaus Krause wrote:
> Am 02.08.2011 23:45, schrieb Joshua Maurice:
>> On Aug 1, 12:25 am, "crea"<n...@invalid.com>  wrote:
>>> I need to port C++ code to C code. It includes templates and classes. Is
>>> this possible and is there any programs which would do this automatically?
>>> Or any other help regarding this. Thank you
>>
>> You are asking, as explained else-thread, that you are looking for a
>> way to convert the C++ code to maintainable and readable C code.
>>
>> If the C++ code uses exceptions, you're in a world of pain. It's
>> borderline impossible for this to be automated. C++ exceptions are the
>> one C++ feature that does not map nicely onto C.
>
> Pardon my ignorance (I've never written a C++ compiler), but what's the
> problem with exceptions? I'd imagine them to be rather straightforward
> to implement using setjmp()/longjmp().

I am thinking the complexity is in "stack unwinding", due to the need to 
destruct all local objects still "alive" between the 'try' and 'throw'. 
  IOW, it's not as simple as just transferring control from one part of 
the code to the other.  C doesn't have the "stack unwinding" need, you see.

V
-- 
I do not respond to top-posted replies, please don't ask

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is there any software porting C++ to C? "crea" <no@invalid.com> - 2011-08-01 08:25 +0100
  Re: Is there any software porting C++ to C? Ian Collins <ian-news@hotmail.com> - 2011-08-01 19:42 +1200
    Re: Is there any software porting C++ to C? "crea" <no@invalid.com> - 2011-08-01 08:47 +0100
      Re: Is there any software porting C++ to C? "Bo Persson" <bop@gmb.dk> - 2011-08-01 11:21 +0200
        Re: Is there any software porting C++ to C? "crea" <no@invalid.com> - 2011-08-01 10:26 +0100
      Re: Is there any software porting C++ to C? Ian Collins <ian-news@hotmail.com> - 2011-08-01 21:26 +1200
        Re: Is there any software porting C++ to C? "crea" <no@invalid.com> - 2011-08-01 11:16 +0100
          Re: Is there any software porting C++ to C? Robert Wessel <robertwessel2@yahoo.com> - 2011-08-01 11:59 -0500
            Re: Is there any software porting C++ to C? BGB <cr88192@hotmail.com> - 2011-08-01 14:18 -0700
            Re: Is there any software porting C++ to C? James Kanze <james.kanze@gmail.com> - 2011-08-07 11:39 -0700
  Re: Is there any software porting C++ to C? Juha Nieminen <nospam@thanks.invalid> - 2011-08-01 08:48 +0000
    Re: Is there any software porting C++ to C? "crea" <no@invalid.com> - 2011-08-01 10:29 +0100
    Re: Is there any software porting C++ to C? "Waldek M." <wm@localhost.localdomain> - 2011-08-04 21:54 +0200
  Re: Is there any software porting C++ to C? Marcel Müller <news.5.maazl@spamgourmet.com> - 2011-08-01 11:29 +0200
  Re: Is there any software porting C++ to C? Joshua Maurice <joshuamaurice@gmail.com> - 2011-08-02 14:45 -0700
    Re: Is there any software porting C++ to C? Philipp Klaus Krause <pkk@spth.de> - 2011-08-04 19:30 +0200
      Re: Is there any software porting C++ to C? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-04 13:53 -0400
        Re: Is there any software porting C++ to C? jt@toerring.de (Jens Thoms Toerring) - 2011-08-04 20:38 +0000
        Re: Is there any software porting C++ to C? Nobody <nobody@nowhere.com> - 2011-08-04 21:54 +0100
      Re: Is there any software porting C++ to C? BGB <cr88192@hotmail.com> - 2011-08-04 15:40 -0700
  Re: Is there any software porting C++ to C? Uwe Dolinsky <uwe@codeplay.com> - 2011-08-03 07:34 -0700

csiph-web