Giter Club home page Giter Club logo

Comments (6)

cameron314 avatar cameron314 commented on June 4, 2024

Hmm, that's unfortunate. In that case, is it even possible (in a standard-compliant way) to declare an object with enough bytes for N T objects without initializing said memory?

from concurrentqueue.

cameron314 avatar cameron314 commented on June 4, 2024

Ooh. Apparently C++11 allows non-POD types in unions now, for exactly this kind of scenario. The constructors/destructor are not called automatically, which is exactly what I was trying to avoid with my char[] workaround. I'll try that if MSVC supports it.

from concurrentqueue.

cameron314 avatar cameron314 commented on June 4, 2024

Aw, no, unions can't hold any type with a non-trivial copy constructor.
It looks like there's no built-in way to do this sort of manual memory management. However, I can use intermediate casts to hopefully trick the compiler into doing the right thing. See http://stackoverflow.com/questions/13466556/aligned-storage-and-strict-aliasing

from concurrentqueue.

cameron314 avatar cameron314 commented on June 4, 2024

Let me know if this fixes the warning. Thanks!

from concurrentqueue.

AstralStorm avatar AstralStorm commented on June 4, 2024

Seems fine.

from concurrentqueue.

cameron314 avatar cameron314 commented on June 4, 2024

Great, thank you!

from concurrentqueue.

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.