Login  Register

Re: HOWTO: Compiling LibreCAD with Visual Studio 2003 (and Qt 4.3.1 ...)

Posted by tin-pot on Dec 30, 2011; 1:49pm
URL: https://forum.librecad.org/HOWTO-Compiling-LibreCAD-with-Visual-Studio-2003-and-Qt-4-3-1-tp5108768p5110049.html

Hi Dongxu,

thank you for the help on Git! I'll try it out soon.

dxli wrote
std::isnormal() is used to verify the number is not zero (of cause, not
NAN/INF). We use it to tell the difference between ellipse arc and whole
ellipses. For example, an ellipse arc has start/end angles, if both are set
to be exactly zero ( isnormal() = false), we treat the ellipse arc as an
whole ellipse. This is different from an whole range arc, because an arc
from 0 to 2 Pi will still have a start/end point, while a whole ellipse has
no start/end point.
I see. I just wondered if a simple comparison to zero wouldn't do the
job easier. Or, even easier - and safer - have a three-valued orientation
flag (CW arc, CCW arc, full turn); this would mirror the situation with
circular arcs/circles.

dxli wrote
I suppose std::isnormal() is C++ standard, we just have to figure out how
to use it in windows.
Well, kind of: AFAIK it was first specified in C99 (ISO 9899:1999) and then
adopted in <cmath> of C++11 (ISO 14882:2011). I don't know how
common C++11 is supported today - current MSVC versions up to 2010
obviously don't care.

However, floating point classification functions are easy to emulate on MSVC
(there has been a _fpclass() function for years), and that is what I have done.

I think we should try to avoid introducing gratuitous dependencies on such
"bleeding edge" language/library features, or provide workarounds. After all,
Win XP 32/MSVC 2003 is still a "Tier 1" platform for Qt 4.5, and MSVC 2005
for Qt 4.7, so why hinder platform portability without necessitation?

Thank you, and happy holidays!

Martin