[Libreoffice] [PATCH] ScGlobal::GetAutoFormat not always required to create fresh instance
Kohei Yoshida
kohei.yoshida at suse.com
Mon Jan 9 06:22:34 PST 2012
Hi Stephan,
On Mon, 2012-01-09 at 09:29 +0100, Stephan Bergmann wrote:
> However, whether it actually would be an advantage to not have to
> address the other calls to GetAutoFormat, I am not sure. After all,
> those calls that afterwards check for null-ness *are* dubious.
Indeed. I've gotten used to seeing stuff like that, and I always check
the definition of the getter to see if I should check for NULL or not.
Having said that, that doesn't mean it's not beneficial to make it
explicit by way of method name.
I'm all for your proposed change which will undoubtedly improve the
readability of the code.
What I personally would do is, in case the method always returns a live
instance, I would have it return a reference instead of a pointer. But
that's just a matter of taste, I think. I'm fine with the way you're
proposing.
Best,
Kohei
--
Kohei Yoshida, LibreOffice hacker, Calc
More information about the LibreOffice
mailing list