I'm porting CEGUI to PS3 and I encounter a problem.
It seems that PS3 disable support for exception handling. So the code will not compile when it see CEGUI code.
There are some info about using _HAS_EXCEPTIONS to disable STL dll but I'm not sure if that does anything since I'm getting compile error, not linking, not run-time.
Is there a way to disable exception build-in in CEGUI? or should I just manually comment out all throw lines?
Disable exception
Moderators: CEGUI MVP, CEGUI Team
Re: Disable exception
Hi. As far as I know there is nothing currently built into CEGUI to disable exception handling. I know that this topic has been discussed previously and CE seemed discouraged to add this. Searching for "disabling exceptions" brought up this thread in particular. It sounds like CE is open to some persuasion in regards to this.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Disable exception
Yeah, currently commenting affected constructs will be the way to go. As Jamarr mentioned, this is something were considering based on the thread linked; it's not a facility I like adding, because such things unfortunately get abused by noobs and we're left to pick up the pieces. It will likely go in at some stage though (either a later 0.7.x point or more likely for the 0.8.0 release).
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
-
- Just popping in
- Posts: 13
- Joined: Wed Oct 21, 2009 20:21
Re: Disable exception
Will commenting out throw lines effect how CEGUI work? What I'm asking is, does CEGUI use exception for regular operation? or only use exception for error handling?
If it's just for error handling, then I assume it would be safe to remove them since we wouldn't run into these errors on final release. But it would be a different story if it use exception to do basic window operation.
If it's just for error handling, then I assume it would be safe to remove them since we wouldn't run into these errors on final release. But it would be a different story if it use exception to do basic window operation.
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Re: Disable exception
[edit] Some answers first:
Cegui has already been made more forgiving, and some exceptions have been removed. So generally, exceptions are only used for fatal things now.
[/edit]
When you disable a 'throw', the code will continue, which is unwanted. Just returning isn't always possible either, because then the client code doesn't know something went wrong.
Most 'severe' functions however do return something; a window, an imageset, a font and so on. So you could turn part of the code in a way that your client checks for not-null after such calls. Of course, meaning that instead of a throw, you return a NULL.
For the 'void' functions, you could rely on on a sort of Set/Get last error, like some C-style API's do. So before returning (in stead of throwing) you can set a last error, like
And then in your client call, you check for an error flag.
HTH.
Btw it's cool to read that you are working (or at least trying to!) with Cegui on a console
Cegui has already been made more forgiving, and some exceptions have been removed. So generally, exceptions are only used for fatal things now.
[/edit]
When you disable a 'throw', the code will continue, which is unwanted. Just returning isn't always possible either, because then the client code doesn't know something went wrong.
Most 'severe' functions however do return something; a window, an imageset, a font and so on. So you could turn part of the code in a way that your client checks for not-null after such calls. Of course, meaning that instead of a throw, you return a NULL.
For the 'void' functions, you could rely on on a sort of Set/Get last error, like some C-style API's do. So before returning (in stead of throwing) you can set a last error, like
Code: Select all
CEGUISetLastError("DefaultResourceProvider::load - Filename supplied for data loading must be valid");
And then in your client call, you check for an error flag.
HTH.
Btw it's cool to read that you are working (or at least trying to!) with Cegui on a console
Check out my released snake game using Cegui!
Re: Disable exception
I'm fairly certain that you can enable exceptions on the PS3?
Anyway, I really cannot see supporting error-codes/error-states as a viable alternative to exceptions. How would you support both error handling techniques simultaneously? I can only imagine it being a nightmare.
The best options I can see are:
Anyway, I really cannot see supporting error-codes/error-states as a viable alternative to exceptions. How would you support both error handling techniques simultaneously? I can only imagine it being a nightmare.
The best options I can see are:
- A simple macro as proposed in the linked thread, though with CEGUI_THROW always calling terminate().
- Using C's setjmp/longjmp (eg cexcept) though that comes with it's own pitfalls...
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
- scriptkid
- Home away from home
- Posts: 1178
- Joined: Wed Jan 12, 2005 12:06
- Location: The Hague, The Netherlands
- Contact:
Re: Disable exception
Hi,
Of course my suggestion for the error-codes was merely a local change on his own machine. Not something i would see valid for a future Cegui enhancement
Calling 'exit' might be a good option too, especially when it's a product baked onto a disc, when cegui's kind of exceptions are pretty unlikely to happen.
Of course my suggestion for the error-codes was merely a local change on his own machine. Not something i would see valid for a future Cegui enhancement
Calling 'exit' might be a good option too, especially when it's a product baked onto a disc, when cegui's kind of exceptions are pretty unlikely to happen.
Check out my released snake game using Cegui!
-
- Just popping in
- Posts: 13
- Joined: Wed Oct 21, 2009 20:21
Re: Disable exception
Thanks for all the reply.
It looks like it's save to replace exception with termination. CEGUI doesn't seem to use exception other than error reporting.
And yes, PS3 does have exception support but devil always lies in the details. In this case, it depends on which CPU you use, and in certain case it may violate the TRC.
It looks like it's save to replace exception with termination. CEGUI doesn't seem to use exception other than error reporting.
And yes, PS3 does have exception support but devil always lies in the details. In this case, it depends on which CPU you use, and in certain case it may violate the TRC.
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 2 guests