Coder Social home page Coder Social logo

FormatTimeInMillisAsSeconds in gtest/src/gtest.cc:3504 causes compile errors when using conversion checking about googlemock HOT 3 OPEN

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
FormatTimeInMillisAsSeconds in gtest/src/gtest.cc:3504 causes compile errors when using conversion checking

from googlemock.

Comments (3)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
This was valid C++, relying on implicit conversion to double.
I don't know that we need to be clear of all possible warnings on all possible 
compilers.

-Wconversion is not included in -Wall or -Wextra because it triggers so often 
on safe code.

https://gcc.gnu.org/wiki/NewWconversion#Frequently_Asked_Questions

"Implicit conversions are very common in C. This tied with the fact that there 
is no data-flow in front-ends (see next question) results in hard to avoid 
warnings for perfectly working and valid code. Wconversion is designed for a 
niche of uses (security audits, porting 32 bit code to 64 bit, etc.) where the 
programmer is willing to accept and workaround invalid warnings. Therefore, it 
shouldn't be enabled if it is not explicitly requested."

Original comment by [email protected] on 7 Mar 2015 at 4:05

from googlemock.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
Understood. But do you think the patch I suggested would be wrong ? If not, 
wouldn't it be ok to include it and make life easier for those that do use the 
compiler option during 32-bit to 64-bit port ?

Original comment by [email protected] on 7 Mar 2015 at 4:11

from googlemock.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 12, 2024
If you're using that compiler option, it is emitting warnings, not errors.

There are indeed 64-bit values of 'ms', representing intervals of about 150k+ 
years, for which the conversion to double will be lossy. The printing of those 
intervals will be similarly lossy, as stringstream will print only 6 places of 
precision by default. So the change i correct.

I don't want to commit to keeping gtest free of such warnings, though.

Original comment by [email protected] on 7 Mar 2015 at 7:19

from googlemock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.