Git Product home page Git Product logo

Comments (5)

Dani-Hub avatar Dani-Hub commented on July 26, 2024 1

Since {fmt} disallows arbitrary pointers you still need a cast in which case volatile can be omitted. Is there a more compelling example?

I think a more compelling example is that you have actually a volatile T* p for formatting, but it doesn't suffice to add apply static_cast<const void*> to p in your code, but you also need to add another const_cast<const T*> to it first.

from fmt.

Dani-Hub avatar Dani-Hub commented on July 26, 2024

What the submitter is referring to is the adopted paper P1147.

from fmt.

vitaut avatar vitaut commented on July 26, 2024

Since {fmt} disallows arbitrary pointers you still need a cast in which case volatile can be omitted. Is there a more compelling example?

from fmt.

ZXShady avatar ZXShady commented on July 26, 2024

@vitaut

lets say I have a volatile int* and want to format it I have to do this

volatile int* p = (int*)0xdeadbeef;
fmt::format("{}",const_cast<void*>(static_cast<volatile void*>(p))); // or do static_cast<void*>(const_cast<int*>(p))

if fmt allowed to print const volatile void* then I do not need the last const cast.

the godbolt link was to show that you can't print it

from fmt.

vitaut avatar vitaut commented on July 26, 2024

Makes sense, a PR to avoid volatile void* support would be welcome.

from fmt.

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.