Date: Thu, 24 Jul 2025 07:47:55 -0700
On Thursday, 24 July 2025 00:00:28 Pacific Daylight Time François Plumerault
via Std-Discussion wrote:
> namespace prv {
> class Dummy {
> public:
Why not:
struct core_dummy_s {};
namespace prv {
class Dummy : public core_dummy_s
{
public:
....
In fact, why does prv::Dummy need to be a separate type from core_dummy_s?
And why are you creating a C++ wrapper around a C API of a C++ implementation?
Can't you remove the middle abstraction?
> DummyClass const& getConstDummy() {
> core_dummy_s const* p = nullptr;
> core_get_const_dummy(&p);
> return *reinterpret_cast<DummyClass const*>(p);
> }
This isn't correct either: there is no object DummyClass at that location.
This will probably work, but isn't legal.
via Std-Discussion wrote:
> namespace prv {
> class Dummy {
> public:
Why not:
struct core_dummy_s {};
namespace prv {
class Dummy : public core_dummy_s
{
public:
....
In fact, why does prv::Dummy need to be a separate type from core_dummy_s?
And why are you creating a C++ wrapper around a C API of a C++ implementation?
Can't you remove the middle abstraction?
> DummyClass const& getConstDummy() {
> core_dummy_s const* p = nullptr;
> core_get_const_dummy(&p);
> return *reinterpret_cast<DummyClass const*>(p);
> }
This isn't correct either: there is no object DummyClass at that location.
This will probably work, but isn't legal.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Platform & System Engineering
Received on 2025-07-24 14:47:59