From: Robert Klemme Date: 2003-10-02T19:05:38+09:00 Subject: Re: C or C++? "Thomas Sondergaard" schrieb im Newsbeitrag news:3f7bef63$0$48887$edfadb0f@dtext02.news.tele.dk... > > Ruby is really C-oriented. It longjmps on errors, so the stack doesn't > > "unwind" the way C++ objects really wants it to. > > I think I understand what you mean. Is it that destructors may not be called > as expected? Please elaborate! > > > There are work-arounds > > for that, but I found that without a good foundation of libraries to > > work with, C++ was a real pain, so I stick with C. > > What kind of work arounds? If you rb_protect everything the longjmp's should > only happen in ruby-land, and you should be safe in C++, right? You can only be safe in C++ land if your C++ never invokes Ruby C functions which might longjump. So, if you just do C++ processing and return values it's ok, but if part of your C++ processing is to invoke methods defined in Ruby (likely for callbacks such as blocks) you can easily shoot yourself in the foot... Regards robert