Opened 11 years ago

Last modified 11 years ago

#6055 new Bugs

unqualified sqrt() fails to compile on SunCC/SunOS

Reported by: Fedor Sergeev <Fedor.Sergeev@…> Owned by: Gunter
Milestone: To Be Determined Component: uBLAS
Version: Boost 1.47.0 Severity: Problem
Keywords: SunCC Cc:

Description

Compiling uBlas' test_complex_norms on SunOS with SunCC:

]  sunCC -library=stlport4 -I../ ../libs/numeric/ublas/test/test_complex_norms.cpp
"../libs/numeric/ublas/test/test_complex_norms.cpp", line 37: Error: The function "sqrt" must have a prototype.
"../libs/numeric/ublas/test/test_complex_norms.cpp", line 37: Error: The function "sqrt" must have a prototype.
"../libs/numeric/ublas/test/test_complex_norms.cpp", line 65: Error: The function "sqrt" must have a prototype.
"../libs/numeric/ublas/test/test_complex_norms.cpp", line 65: Error: The function "sqrt" must have a prototype.
4 Error(s) detected.

The standard math header included here - <cmath> - does not inject math functions into the global namespace. The only standard way to use these functions (sqrt included) is via std:: namespace.

All the uses of sqrt should be converted to std::sqrt, otherwise compilers with strictly conforming STLs (like SunCC -stlport4) will not be able to compile.

std::sqrt works fine with all the compilers I tried (SunCC, g++).

(suggested patch attached)

Attachments (1)

diffs (986 bytes ) - added by Fedor Sergeev <Fedor.Sergeev@…> 11 years ago.
patch for std::sqrt

Download all attachments as: .zip

Change History (2)

by Fedor Sergeev <Fedor.Sergeev@…>, 11 years ago

Attachment: diffs added

patch for std::sqrt

comment:1 by Fedor Sergeev <Fedor.Sergeev@…>, 11 years ago

compilers with strictly conforming STLs (like SunCC)

Sorry for slightly misleading cut-n-paste from a different ticket. No STL usage here.

Meant "compilers with strictly conforming standard headers (like SunCC)".

Note: See TracTickets for help on using tickets.