Boost logo

Boost :

From: Ruben Perez (rubenperez038_at_[hidden])
Date: 2024-11-16 13:17:53


vtable.hpp contains the following piece of code:

      auto r = mod.insert(value{argv[1]},
                          boost::span<value>{reinterpret_cast<value
*>(argv + 2),

static_cast<std::size_t>(argc - 2)},
                                             sqlite3_vtab_on_conflict(db));

Where argv is a sqlite3_value **, and sqlite3::value is a wrapper
class roughly looking like this:

struct value
{
    // More member functions
    explicit value(sqlite3_value * value_) noexcept : value_(value_) {}
private:
    sqlite3_value * value_ = nullptr;
};

I had the impression that such a cast is UB (although it seems to work
and seems to be accepted by ubsan). Could someone with more knowledge
about the language point out whether this is allowed or not (and why)

Thanks,
Ruben.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk