Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36326

Fix untyped pointers from uchar* to void*

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • Compiling
    • None

    Description

      People use unsigned char as a stand-in for "byte" in practice (though uint8_t is more explicit).
      Thus I heard that uchar* (meaning "pointer to bytes") was once a stand-in for void* back before, well, void* was standardized.

      But technologies have evolved since that time immemorial.
      Now more often than not uchar* is a requirement for explicit (uchar *), specifically reinterpret_cast<uchar *>.
      As a C++ newb, all I know about reinterpret_cast is that it's abused more often than not.

      void* not only comes with implicit casts, but this cast is also standardized.
      In comparison, I recall UBSAN complained about non-explicit uchar* casting before.

      Our in-house HASH set is a significant user of uchar*.
      Unless we replace all our hash-collections with C++ std::(unordered_)map/set (which pure-C instances might not), this discrepancy is bound to continue causing inconveniences.

      Attachments

        Issue Links

          Activity

            ParadoxV5 Jimmy Hú created issue -
            ParadoxV5 Jimmy Hú made changes -
            Field Original Value New Value
            Description People use {{unsigned char}} as a stand-in for "byte" in practice (though {{uint8_t}} is more explicit).
            Thus I heard that {{uchar*}} (meaning "pointer to bytes") was once a stand-in for {{void*}} back before, well, {{void*}} was standardized.

            But technologies have evolved since that time immemorial.
            Now more often than not {{uchar*}} is a requirement for explicit {{(uchar *)}}, specifically {{reinterpret_cast<uchar *>}}.
            As a C++ newb, all I know about {{reinterpret_cast}} is that it's abused more often than not.

            {{void*}} not only comes with implicit casts, but this cast is also standardized.
            In comparison, I recall UBSAN complained about non-explicit {{uchar*}} casting before.

            Our in-house {{HASH}}set is a significant user of {{uchar*}}.
            Unless we replace all our hash-collections with C++ {{std::}}({{unordered_}}){{map}}/{{set}}s (which pure-C instances might not), this discrepancy is bound to continue causing inconveniences.
            People use {{unsigned char}} as a stand-in for "byte" in practice (though {{uint8_t}} is more explicit).
            Thus I heard that {{uchar*}} (meaning "pointer to bytes") was once a stand-in for {{void*}} back before, well, {{void*}} was standardized.

            But technologies have evolved since that time immemorial.
            Now more often than not {{uchar*}} is a requirement for explicit {{(uchar *)}}, specifically {{reinterpret_cast<uchar *>}}.
            As a C++ newb, all I know about {{reinterpret_cast}} is that it's abused more often than not.

            {{void*}} not only comes with implicit casts, but this cast is also standardized.
            In comparison, I recall UBSAN complained about non-explicit {{uchar*}} casting before.

            Our in-house {{HASH}} set is a significant user of {{uchar*}}.
            Unless we replace all our hash-collections with C++ {{std::}}({{unordered_}}){{map}}/{{set}} (which pure-C instances might not), this discrepancy is bound to continue causing inconveniences.
            ParadoxV5 Jimmy Hú made changes -

            People

              Unassigned Unassigned
              ParadoxV5 Jimmy Hú
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.