Re: should out parametets be initialized if error occurs?
- From: "Simon Trew" <noneofyour@xxxxxxxxxxxx>
- Date: Mon, 10 Oct 2005 16:08:56 +0100
"TH" <TH@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FE58A8E4-0F32-4A97-9255-2BABEC2173B8@xxxxxxxxxxxxxxxx
>
> Hi,
>
> This was originally brought to attention by a colleague of mine and I
> thought it would be interesting to get some views on this.
>
> Take an example:
>
> int ProcessBuffer(/*IN*/SomeATD* buffer);
I don't really understand what you mean. Your message subject asked about
"out" parameters but this function's comment tends to indicate you are
talking about "in" parameters.
In general, you just need to make sure that whoever is responsible for
destroying the object still gets a chance to do so if an error occurs. In
the case of an "out" parameter, since you're probably not passing out the
object, you don't need to set it to anything. You can just insist that the
client does not try to use the pointer when an error is returned.
.
- Prev by Date: Re: Question about C++ file name
- Next by Date: XP styles on an MFC app
- Previous by thread: Re: should out parametets be initialized if error occurs?
- Next by thread: Re: Question about C++ file name
- Index(es):
Relevant Pages
|