[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: Re: catching first chance exception question
From: Eric Pouech <pouech-eric () wanadoo ! fr>
Date: 2004-02-27 18:18:06
Message-ID: 403F89DE.8000704 () wanadoo ! fr
[Download RAW message or body]
Robert Reif a écrit :
> I'm looking at how windows deals with invalid
> parameters in some of the winmm functions and
> it raises some questions. Sometimes they will check
> the parameters and return an error code and
> sometimes they will let a bad parameter cause
> a first-chance exception and catch it and return
> an error code.
>
> Is it ok to do a simple NULL pointer check and return an
> error rather than letting it cause an exception and catching
> it? If not, what's the best way to catch the exception and
> return the proper error code?
the normal rule of thumbs is:
- don't use exception unless you have to (ie, we have a clear case of an
application requiring that feature) => first implementation should be
only based on NULL pointer testing
- if you need to go further, then setting an exception handler is the
thing to do (using IsBadReadPtr or IsBadWritePtr is a not 100% safe,
especially in multi-threaded environments)
A+
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic