-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
High EffortMore than 2 weeks of timeMore than 2 weeks of timeHigh priorityMultiple features rely on this, it is a milestone, or issue strongly effects end usersMultiple features rely on this, it is a milestone, or issue strongly effects end usersenhancementImprove or add new featuresImprove or add new featurestodoPlanned implementationPlanned implementation
Description
Primary issue with porting to C is use of try/catch. Resolution strategies:
- Emulate try/catch with setjmp/longjmp
try/catch does 3 important things:
- It opens an exception safe code block
- It produces a stack trace
- It produces named, detailed exception messages
Producing all of these in C is difficult.
- Can be done with a fork() or setjmp/longjmp. Both are equally as expensive (I think. I need to research this). fork() is not posix or windows compliant. There is no equivalent command that works on both posix and windows, but there are commands that work on each. Different implementations would be required for each target. setjmp/longjmp is posix and windows compliant. Any goto in between setjmp and longjmp will leak memory, so caution must be taken.
- Can be accomplished with glibc execinfo.h backtrace(). A rough equivalent exists on windows, but requires multiple libraries and an executable to be installed: no. A cross platform library targetting linux, bsd, and windows exists called libbacktrace
- The best C can do regarding this is print what signal killed it. No C compatable function can interface naturally with the cpp exception system. A compilation switch between these two systems will be necessary to maintain the full use of cpp exceptions.
Use of classes and namespaces must be removed as well, but use of these is limited anyways and won't require complex restructuring.
Metadata
Metadata
Assignees
Labels
High EffortMore than 2 weeks of timeMore than 2 weeks of timeHigh priorityMultiple features rely on this, it is a milestone, or issue strongly effects end usersMultiple features rely on this, it is a milestone, or issue strongly effects end usersenhancementImprove or add new featuresImprove or add new featurestodoPlanned implementationPlanned implementation