kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #42785
Re: Using OPT types
Le 24/11/2019 à 18:09, Wayne Stambaugh a écrit :
> On 11/24/19 7:12 AM, Jeff Young wrote:
>> Personally I hate OPT (because it’s somewhat harder to read and more-than-somewhat harder to debug).
>
> I tend to agree with Jeff. The older I get, the less I like having to
> dig around the code base to figure out what is going on because
> templated code does tend to be less fun to debug.
>>
>> I also dislike auto, except in the case of stl::’s overly-verbose iterators. Again, they make the code harder to read more often than not.
>
> I'm seriously rethinking typedefs as well. I can never seem to remember
> the type they represent so I have to dig around the source to figure out
> the actual type. I'm thinking just typing out the full type is easier
> in the shortened typedefed version which was most likely only created to
> save some typing.
>
>>
>> Maybe I’m just showing my age….
>
> Funny how age changes your perspective.
>
I full agree with Jeff and Wayne:
auto (and OPT) obfuscate the code.
As Jeff said, auto is useful only in the case of stl::’s overly-verbose
iterators.
I already had to fix bugs in code using auto due to this obfuscation.
>>
>>> On 24 Nov 2019, at 11:13, Ian McInerney <Ian.S.McInerney@xxxxxxxx> wrote:
>>>
>>> What is the current consensus on using OPT types in the code? I know there are some instances where we are already using them from the Boost library (since our C++ version isn't high enough to include them), but is that considered a good type to use more of?
>>>
>>> I am curious, because I am thinking of replumbing the position storage in the tool events to use OPTs for the position, because that will allow for cleaner handling of the position in the tools, and also because I need to pass the positions into the selection routines, and being able to pass an OPT will greatly simplify things (I think).
>>>
>>> -Ian
--
Jean-Pierre CHARRAS
References