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
On Mon, Mar 31, 2003 at 01:22:37PM -0700, Micah Dowty wrote:
> Hi Everybody,
>
> It will still be a few months yet until we're really coding Om and
> PicoGUI 2.0, but this is a decision worth a discussion:
> Should the core components of Om and PicoGUI 2.0 be written in C or C++?
>
> Here are a few arguments each way:
>
> - In favor of C:
>
> - smaller binary size
> - C++'s class-based object model won't help much in implementing Om's
> python-like object model.
> - possibly more compatibility with older systems that don't support C++
> - C code is natively compatible with many other languages, while C++ must
> use 'extern "C"' functions for compatibility, not allowing the other
> language access to C++'s class-based object model.
>
> - In favor of C++:
>
> - C++'s classes won't help implement Om, but they do provide a more standard
> way to organize the source code.
> - C++ code can be compiled without libstdc++ to produce binaries not much
> larger than C. (http://fresco.org/~njs/c++-without-stdc++)
> - C++ includes exceptions and constructors/destructors, two features we would
> definitely need to implement by hand if we used C.
>
> --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/
> _______________________________________________
> Pgui-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/pgui-devel
--
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/
_______________________________________________
Pgui-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/pgui-devel