Tcl Source Code

View Ticket
Login
Ticket UUID: 3372130
Title: Fix hypot math function with MSVC10
Type: Patch Version: None
Submitter: Created on: 2011-07-20 08:57:13
Subsystem: 52. Portability Support Assigned To: nijtmans
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2011-07-21 23:42:34
Resolution: Fixed Closed By: nijtmans
    Closed on: 2011-07-21 16:42:34
Description:
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.
User Comments: nijtmans added on 2011-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

added on 2011-07-20 15:57:15:

File Added - 418768: hypot.patch

Attachments: