Code Monkey home page Code Monkey logo

Comments (8)

sapek avatar sapek commented on August 14, 2024

sprintf_s is not a standard function. std::snprintf is only available in C++11 and for example VC12 doesn't support it.

from bond.

Porges avatar Porges commented on August 14, 2024

I think even snprintf is banned by SDL. Could we conditionally upgrade to using sprintf_s if MSVC is detected? (Since it's writing into a stack-allocated buffer the code would just need to switch function calls without further changes - sprintf_s is templated for this case.)

from bond.

Porges avatar Porges commented on August 14, 2024

Potential fix: https://github.com/Porges/bond/commit/9c29ed6c7c2b041231d0cab33341903f4b457630

from bond.

sapek avatar sapek commented on August 14, 2024

I don't want to add conditional code with proprietary extensions. A better solution is to get rid of sprintf altogether. It is an overkill anyways since we only depend on it to convert integers to string.

from bond.

jasonzio avatar jasonzio commented on August 14, 2024

"Get rid of sprintf altogether" is always the better choice for simple conversions. For complex conversions, thatโ€™s what std::ostringstream is for.

from bond.

Porges avatar Porges commented on August 14, 2024

Would it be sane to just replace the custom basic_string_stream class with the std one? Then this could be avoided entirely - assuming there's not a strong reason to keep it. Does it exist for performance concerns/compatibility?

from bond.

sapek avatar sapek commented on August 14, 2024

Performance.

from bond.

Porges avatar Porges commented on August 14, 2024

OK. I guess I can just switch on _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES anyway โ˜บ

from bond.

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.