Skip to content

Default initialise the key value in KeyedObject.

Currently the value of the key in KeyedObject is uninitialised in the default constructor. This means the value of the key is undefined until it is explicitly set, when the object is saved to a container. This can cause annoyances, for instance when I was recently investigating differences between different builds (opt versus debug) in the LHCb software stack. In this scenario I was using some standard debug printout in various algorithms, that often print data objects, including their keys, before they are saved to containers. Differences in the default key value was causing annoying 'white-noise' in the diffs I was then comparing.

The previous comment suggests this was intentional, but I do not really see the need for this. The proposed patch here adds a default initialiser ({}) and in my tests with the LHCb software stack removed the deferences I was seeing between builds.

Merge request reports