← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] S3D Mesh Smart Pointer

 

Hi Cirilo,

Sure, I know code analysis is good.
Things like variable initialization is something generally understood by everyone as a good coding practices and easy to understand.
In other way, things like Brian did are very much complicated to understand (at least for me )

Example
This: std::vector< S3D_MESH * >       childs;

Was converted to this:
typedef boost::shared_ptr<S3D_MESH> S3D_MESH_PTR;
S3D_MESH_PTRS                   childs;

And this:
m_model = NULL;

to this:
m_model.reset();


So perhaps some one can summarize this changes need (or, how the things should be properly implemented in the future developments) so when we pass it in Coverity ..it will be more happy :)


"you just code as normal and let the tool do its job and help you find bugs."

Here I don't agree..
Lets say if I am a very bad practice coder and only when I finish my new code and everything I run the Coverity and see "uhm ups I shouldn't did things this way.." and then, as Brian did, had to change code in 7 files and re-test everything.
So thats why I think we should know a bit more in advance to prevent this things and have good code practices since the beginning.

Regards,
Mario Luzeiro



________________________________________
From: Cirilo Bernardo [cirilo.bernardo@xxxxxxxxx]
Sent: 13 April 2015 23:36
To: Mário Luzeiro
Cc: Brian Sidebotham; KiCad Developers
Subject: Re: [Kicad-developers] [PATCH] S3D Mesh Smart Pointer

Hi Mario,

 The Coverity analysis tool is not so bad; even without customizing it so much there are very few cases where it wants you to do something trivial to make it happy. It seems to be very good for catching all kinds of bugs and dead code as well. So you don't code to make Coverity happy, you just code as normal and let the tool do its job and help you find bugs.

- Cirilo

On Tue, Apr 14, 2015 at 7:18 AM, Mário Luzeiro <mrluzeiro@xxxxx<mailto:mrluzeiro@xxxxx>> wrote:
Hi Brian,

I was about to test it but I didn't since first I was trying to fix here an issue in my branch... I will later do it.

I notice you (people here) start to perform code analysis with some tool (Coverity?)
I don't have any experience in using or develop with a code analysis in mind, but I know that when you are developing for code analysis test you have to know in advance what will make is happy, so you do it that way since beginning.

One point I notice so far is the variable initialization (and your pointer now).
Could someone here perhaps make a small guide to the main aspects to have in mind ?
Maybe that could be added to documentation related with coding style and guidelines?..

Thanks in advance!
Regards,
Mario Luzeiro
________________________________________
From: Kicad-developers [kicad-developers-bounces+mrluzeiro=ua.pt@xxxxxxxxxxxxxxxxxxx<mailto:ua.pt@xxxxxxxxxxxxxxxxxxx>] on behalf of Brian Sidebotham [brian.sidebotham@xxxxxxxxx<mailto:brian.sidebotham@xxxxxxxxx>]
Sent: 13 April 2015 23:00
To: KiCad Developers
Subject: Re: [Kicad-developers] [PATCH] S3D Mesh Smart Pointer

I just tested with VRML 1 and VRML 2 and stuff has appeared not to
break, so I just committed this change.

I opted for the boost::shared_ptr as we're not yet C++11 and there is
quite a bit of standard container work going on.

Best Regards,

Brian.


On 11 April 2015 at 00:04, Brian Sidebotham <brian.sidebotham@xxxxxxxxx<mailto:brian.sidebotham@xxxxxxxxx>> wrote:
> Hi Guys,
>
> Could someone who has access to both vrml1 and vrml2 models please
> test the attached patch which uses a smart pointer rather than
> S3D_MESH* to get rid of some coverity issues and feedback whether it
> makes your computer explode, or carry on working normally?
>
> Alternatively, could someone email a couple of vrml files that would
> exercise it and I'll put it through it's paces...
>
> Sorry, there's white space deletions going on in the patch so it's a bit noisy.
>
> Thanks,
>
> Brian.

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp



Follow ups

References