On Thu, 2011-11-24 at 07:50 +0100, Lionel Elie Mamane wrote:
On Wed, Nov 23, 2011 at 06:53:53PM -0500, Kohei Yoshida wrote:
I'd like to have
http://cgit.freedesktop.org/libreoffice/core/commit/?id=0215f8b19451ab67c7fdaf91f2da8298a9b89c47
cherry-picked to the 3-4 branch. It fixes
https://bugs.freedesktop.org/show_bug.cgi?id=39589
I see how ulimit_cast is the wrong choice there, but:
If I understand well, static_cast<unsigned int>(a) where a is a signed
int returns a+2^n where n is the length of int in bits.
For example, for 32 bit ints, static_cast<unsigned int>(-1) is
2^32-1.
Why is that the best solution, rather than 0, which as far as I
understand, limit_cast<unsigned int>(a) would use?
Both are 32-bit integers. We are casting long to unsigned long. And
since the original value is a cell position, it is never negative.
Plus, I don't like those "smart" casters which apparently do wrong
things sometimes and IMO bit unclear how they are supposed to be used,
and apparently with hidden gotchas.
Also, I never said it was the best solution. Rather, it's better than
the current (which "casts" 0 to -1 or 0xFFFFFFFF). To me, that's enough
of an argument but other people may disagree. *shrug*
Kohei
--
Kohei Yoshida, LibreOffice hacker, Calc
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.