From: Albert Chou Date: 2004-07-28T08:35:06+09:00 Subject: Re: Anyone tried compiling Ruby with c++? ------_=_NextPart_001_01C47431.D0270D3A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Maybe Ch (http://www.softintegration.com/), being an C/C++ interpreter, supports C++ exceptions? Al =20 -----Original Message----- From: Asfand Yar Qazi [mailto:im_not_giving_it_here@i_hate_spam.com]=20 Sent: Tuesday, July 27, 2004 4:07 PM To: ruby-talk ML Subject: Re: Anyone tried compiling Ruby with c++? Paul Brannan wrote: > On Tue, Jul 27, 2004 at 08:00:34PM +0900, Asfand Yar Qazi wrote: >=20 >>No, I didn't say "porting Ruby to C++", I said "compiling Ruby=20 >>with C++." >> >>I think this would solve the problem of longjmping out of C++=20 >>functions (due to throwing Ruby exceptions) and not having=20 >>destructors of stack objects declared in those C++ functions. Or=20 >>am I wrong? >=20 >=20 > Unless I misunderstand you: the longjmp function is part of the C++ > standard (since the C++ standard library includes the C89 standard > library). Recompiling Ruby with a C++ compiler will not eliminate the > calls to longjmp. The C++ standard is very clear that any call to > longjmp that jumps over the desctruction of an automatic object will > result in undefined behavior, irrespective of whether that code was > compiled with a C or a C++ compiler. Ahh... that's what I didn't know. >=20 > It would be possible to modify Ruby to use C++ exceptions, but this > would not be a small change (Ruby wraps calls to longjmp in macros, but > it's not just a matter of changing the macros, since longjmp and > exceptions use a different syntax), and I don't know how well C++ > exceptions would play with Ruby's threads. I wish there was a scripting language that did just that... I am=20 yearning for a scripting language that has support for C++=20 exceptions out-of-the-box... >=20 > Also, C++ has much stricter typing than C, and I suspect that much of > the Ruby source would fail to compiler under a C++ compiler without > modification. I thought of that too. >=20 > Paul >=20 >=20 >=20 thanks for the reply. -- http://www.it-is-truth.org/ ------_=_NextPart_001_01C47431.D0270D3A--