Re: should out parametets be initialized if error occurs?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"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.


.



Relevant Pages

  • Re: Re-sizing Gant ChartPane
    ... you hadn't have drawn my attention to it. ... Ian ... Prev by Date: ...
    (microsoft.public.project.vba)
  • Re: Dutch Rail Question- Can Anyone Help?
    ... Rian van der Borgt, Leuven, Belgium. ... Attention: new e-mail and web address because my provider found it ... Prev by Date: ...
    (uk.railway)
  • Re: BettyJean
    ... in passion. ... It tends to get people's attention. ... Diane Blackman ... Prev by Date: ...
    (rec.pets.dogs.breeds)
  • Re: sorry, really dumb question
    ... Thanks for the pointer. ... sent me before but I didn't pay much attention. ... I paid more attention to it ...
    (microsoft.public.dotnet.csharp.general)
  • Re: Properties
    ... Thx for your advices and attention. ... Marcin Goldyn ... Prev by Date: ...
    (comp.lang.java.programmer)