← Back to team overview

kicad-developers team mailing list archive

Re: Coding style question

 

Tom,

On 8/7/19 6:18 PM, Tomasz Wlostowski wrote:
> Hi Fellow Devs,
> 
> I'm fixing some memory management issues in the P&S by introducing smart
> pointers here and there. Do we have any coding policy on typedefing
> shared_ptrs/unique_ptrs?
> 
> Should I:
> - always use std::shared_ptr<TYPE> explicitly?
> - or am I allowed to typedef std::shared_ptr<TYPE> TYPE_SP (or something
> alike)?
> 
> Cheers,
> Tom

My preference is to use the explicit declaration although I've done both
myself so I don't have a strong opinion.  The problem with using typedef
is that I have to go look up the type.  I know it's a PITA to type out
the explicit declaration so understand the attractiveness of using typedef.

Cheers,

Wayne


References