edawson / gfakluge

A C++ library and utilities for manipulating the Graphical Fragment Assembly format.
http://edawson.github.io/gfakluge/
MIT License
51 stars 20 forks source link

Remove broken path_elem constructor #67

Closed zwets closed 3 years ago

zwets commented 3 years ago

Hi Eric, just going through the code I noticed the odd path_elem() constructor in gfakluge.hpp.

It looks like its intent was to initialise the struct members, but this isn't what it does. Instead it effectively creates five local objects that go out of scope right away, while doing no initialisation.

Since the struct needs no initialisation, this constructor can go away without harm - and with the benefit of faster default construction.

zwets commented 3 years ago

Reading a bit further down, the same goes for the GFAKluge() constructor. It initialises a bunch of local variables (shadowing the class members), but does nothing else. It can be removed without effects. (Did not add this to this patch though.)

edawson commented 3 years ago

Ah, yep, that's strange. I think I wrote these constructors on a train so not terribly surprising. Thanks @zwets !