Fix hypot math function with MSVC10
Closed / Fixed3372130fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-07-20 08:57:13
Executing the hypot math function (e.g. [expr hypot(1,1)]) causes a segmentation fault when Tcl was compiled with MSVC 2010. Since MSVC 2010, there is a definition of hypot in math.h, and _hypot creates a conflict. More info: http://connect.microsoft.com/VisualStudio/feedback/details/633988/warning-in-math-h-line-162-re-nonstandard-extensions-used This patch puts a compiler check (_MSC_VER < 1600) around the define in win/tclWinPort.h.
plain2011-07-20 15:57:15
File Added - 418768: hypot.patch
nijtmans Ticket [3372130fff]: 2 changes
[History diff]2011-07-21 23:07:39
nijtmansplain2011-07-21 23:42:34
allow_comments - 1 Although I cannot reproduce the problem (I'm using VS10 express 32-bit on Windows 7, maybe you are using another), I agree that providing hypot() though a macro while MSVC does it as well is asking for trouble. So, added the protection, modified such that the hypot macro is not provided for any other compiler than MSVC. Applied to all open branches
Log in (anonymous is fine) to add a comment.
Attachments:
- hypot.patch [download] added by anonymous on 2011-07-20 15:57:14. [details]