Re: C++ vs C for PicoGUI 2

Micah Dowty <[email protected]>
Newsgroups gmane.comp.video.picogui.devel
Message-ID <[email protected]>
Nathaniel handed us a link to a really interesting paper on this very topic:
http://freetype.sourceforge.net/david/reliable-c.html

On Mon, Mar 31, 2003 at 04:18:45PM -0700, Micah Dowty wrote:
> Lalo and I have been discussing this more on IRC.
> 
> The main sticking point seems to be exceptions- It would be great to use C++ as
> a C-with-exceptions, but the problem with that comes in interfacing between libOm
> and other components that may be in C, C++, Python, or any other language. If you
> call a C++ function from C (or from a C interface generated for another language)
> the exception wouldn't be handled correctly.
> 
> There are a few solutions to this:
> 
>   - Give up on real C compatibility, and use something C++-friendly like SWIG
>     for interfacing to other languages
> 
>   - Allow users of libOm to produce either C++ exceptions or something C-friendly.
>     This would be a lot of unnecessary pain.
> 
>   - Make Om more like pg1's protocol- a protocol definition with completely 
>     separate implementations in each language.
> 
>   - Give up on using C++ in libOm, and stick to some C-compatible exceptions.
>     The two workable ways to do this that we've come up with so far:
> 
>        - Use calling macros similar to what pg1 uses, but with real objects instead
>          of just integers for exceptions. The objects could be tagged as the stack
>          unwinds, for providing backtraces.
> 
>        - Use setjmp/longjmp and a separate stack. There's an implementation of this
>          in Kazlib: http://users.footprints.net/~kaz/kazlib.html
> 
> --Micah
> 
> 
...

-- 
Only you can prevent creeping featurism!


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.