Author Topic: Use of try and catch  (Read 1678 times)

nednones

  • Guest
Use of try and catch
« on: July 04, 2012, 05:13:36 am »
Does anyone know if the permitted use of the code shown below is allowed on Apple devices?

try
{
   Code inside here
}
catch
{
    //Catch error
}

m4unot

  • Guest
Re: Use of try and catch
« Reply #1 on: July 04, 2012, 05:32:31 am »
Apple allowed this, but i have never tried with this SDK and dont know if it works, but i have just tested it on my mac

see attachment down below

nednones

  • Guest
Re: Use of try and catch
« Reply #2 on: July 04, 2012, 04:27:51 pm »
Cheers m4unot I figured it should be allowed since the try and catch are derived in OOP but not sure what the exception type is thrown. Think DFSDK might need to provide more info on this...

tim

  • Administrator
  • Hero Member
  • *****
  • Posts: 1595
  • Karma: +11/-1
    • View Profile
    • DragonFireSDK
Re: Use of try and catch
« Reply #3 on: July 05, 2012, 12:43:20 pm »
You can catch any type of exception by using the elipsis in the catch block:

Code: [Select]
    try
    {
        // Code to try goes here...
    }
    catch (...)
    {
        printf("Exception thrown!\n");
    }

See here for more info on standard C++ exception handling:

http://cplusplus.com/doc/tutorial%20/exceptions/
Tim Sommers
DragonFireSDK Team