[Mapserver-dev] [PATCH] mapraster.c - fixing memory leaks

John Beisley - RSG josb at pml.ac.uk
Wed Jun 16 11:10:09 EDT 2004


Daniel Morissette wrote:

> Steve Lime wrote:
>
>> Patch aside, what do folks think about using goto's? They seem a great
>> help with things like clean-up. However there's not one in the code
>> presently so I was wondering if there's a bias...
>>
>
> I've always avoided them because I was told way back when by some 
> profs that they were evil, but I guess if they're properly used they 
> could help keep the code cleaner sometimes.
>
> If we use them then I think it should only be when absolutely 
> necessary.  It is generally possible to structure a function so that 
> you can properly cleanup without the use of gotos and without 
> increasing complexity.
>
> My 0.02$
>
> Daniel

I'm not a mapserver dev, but if you're talking about cleaning things up 
after an error has occured then using things like exceptions is usually 
the way forward. They come as standard in C++, but in C you have to do 
some fancy stuff. I am aware of, but have never used, an exception 
library for C at www.zork.org. Wrapping code in try... finally blocks 
should make tidying up after an error somewhat cleaner.

- John

-- 
Website: www.pml.ac.uk
Registered Charity No. 1091222
Company No. 4178503
-------------------------------------------------------------------
This e-mail, its content and any file attachments are confidential.
If you have received this e-mail in error please do not copy,
disclose it to any third party or use the contents or attachments
in any way. Please notify the sender by replying to this e-mail or
e-mail forinfo at pml.ac.uk and then delete the email without making
any copies or using it in any other way.
       
The content of this message may contain personal views which are
not the views of Plymouth Marine Laboratory unless specifically
stated.
       
Email transmission cannot be guaranteed to be secure or error free




More information about the mapserver-dev mailing list