Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++]Handling Exception?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Wed Mar 04, 2009 12:29 am    Post subject: [C++]Handling Exception? Reply with quote

Well, i don't know what's the best method to handle an exception, i mean in delphi i just do it like:

Code:
begin
try
//Code the fails here
except
exit; //exits from the procedure without showing access violation or any error box unless you're doing debug check
end;
end.


but in C++ i see people use:

EXCEPTION_EXECUTE_HANDLER
or
some_except& e
or
EAccessViolation EErrorCheck

try/catch-except

which one to use ? and what's the different ?

i'll be more specific when i get home.
Back to top
View user's profile Send private message
Spawnfestis
GO Moderator
Reputation: 0

Joined: 02 Nov 2007
Posts: 1746
Location: Pakistan

PostPosted: Wed Mar 04, 2009 5:31 am    Post subject: Reply with quote

Roteeeeeeeeeem wrote:
what's the best method to handle an exception

Code:
__try {
        // Rot1 code
}
__except(EXCEPTION_EXECUTE_HANDLER) {
       // Save Rot1
}

_________________

CLICK TO HAX MAPLESTORAY ^ !!!!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
S3NSA
:3
Reputation: 1

Joined: 06 Dec 2006
Posts: 1908
Location: England.

PostPosted: Wed Mar 04, 2009 5:33 am    Post subject: Reply with quote

Not sure if this will be helpful:
http://msdn.microsoft.com/en-us/library/4t3saedz(VS.71).aspx

_________________
~ You can find me on irc.ccplz.net x
Back to top
View user's profile Send private message Visit poster's website
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Wed Mar 04, 2009 4:12 pm    Post subject: Reply with quote

If you want smaller and faster code, don't use exeptions. They're slowwwwwwwwww and hog resources.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Mar 04, 2009 6:10 pm    Post subject: Reply with quote

Jani wrote:
If you want smaller and faster code, don't use exeptions. They're slowwwwwwwwww and hog resources.


On this note, for anyone using c++ who does not want to support exception handling, simply do the following for each of your functions:

Code:
void SomeClass::SomeFunc(void) throw()
{
    // code here
}
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Thu Mar 05, 2009 9:36 am    Post subject: Reply with quote

Flyte wrote:

On this note, for anyone using c++ who does not want to support exception handling, simply do the following for each of your functions:

Code:
void SomeClass::SomeFunc(void) throw()
{
    // code here
}

So what exactly does that do?
And you're example is a class function, can it also be applied to normal functions?
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Thu Mar 05, 2009 9:45 am    Post subject: Reply with quote

tombana wrote:
Flyte wrote:

On this note, for anyone using c++ who does not want to support exception handling, simply do the following for each of your functions:

Code:
void SomeClass::SomeFunc(void) throw()
{
    // code here
}

So what exactly does that do?
And you're example is a class function, can it also be applied to normal functions?


Doesn't matter if it's a part of a class or not.
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Thu Mar 05, 2009 10:08 am    Post subject: Reply with quote

Flyte wrote:
On this note, for anyone using c++ who does not want to support exception handling, simply do the following for each of your functions
Just don't enable it. VS has it enabled by default, you may disable it from the preferences.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Thu Mar 05, 2009 2:34 pm    Post subject: Reply with quote

Jani wrote:
Just don't enable it. VS has it enabled by default, you may disable it from the preferences.


True enough, I just do it because some functions you may actually want exception handling.

tombana wrote:
So what exactly does that do?
And you're example is a class function, can it also be applied to normal functions?


It strips any code from the function that would be generated with exception handling in mind. It's basically telling the compiler: "I'm perfect, I don't throw exceptions, fuck off."

It can be used in normal functions.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites