<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Andrew,</p>
    <p>we regularly do slightly forward incompatible changes in the C++
      API, and they are documented in
      <a class="moz-txt-link-freetext" href="https://gdal.org/en/latest/user/migration_guide.html">https://gdal.org/en/latest/user/migration_guide.html</a> . </p>
    <p>That change has the advantage of avoiding potential usage errors,
      in particular erroneous use of CSLDestroy() on the return value,
      which was possible when we returned "char **".   That way, you can
      distinguish that GetMetadata() return doesn't need to be freed,
      whereas methods such as <a class="moz-txt-link-freetext" href="GDALDataset::GetMetadataDomainList()">GDALDataset::GetMetadataDomainList()</a> or
      GetFileList() that return a "char**" do need to have their return
      value CSLDestroy()'ed after use</p>
    <p>We could potentially have GetMetadata() return a CPLStringList
      (or a const CPLStringList&?) (CPLStringList is a C++ wrapper
      over a "char**" with a <a class="moz-txt-link-freetext" href="std::vector">std::vector</a><> like API) or a
      <a class="moz-txt-link-freetext" href="std::vector">std::vector</a><a class="moz-txt-link-rfc2396E" href="std::string"><std::string></a> / const
      <a class="moz-txt-link-freetext" href="std::vector">std::vector</a><a class="moz-txt-link-rfc2396E" href="std::string"><std::string></a>&  ( returning "const
      CPLStringList&" would have the advantage that for the C API
      GDALGetMetadata(), we could use <a class="moz-txt-link-freetext" href="CPLStringList::List()">CPLStringList::List()</a> to return a
      CSLConstList without involving memory copy)    But those signature
      changes would require both extensive changes in the drivers
      themselves since GetMetadata() is a virtual method they implement,
      and in calling code (only returning "const CPLStringList&"
      would allow user code to make forward compatible changes, but they
      would be more involved than just the change for "char**" ->
      "CSLConstList")</p>
    <p>Even</p>
    <div class="moz-cite-prefix">Le 30/01/2026 à 23:09, Andrew Bell via
      gdal-dev a écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CACJ51z1zXhyaErWjfpv6mG-xsoYkPkDYs9coQauNpUWftyVmxA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>Andrew Bell</div>
              <a href="mailto:andrew.bell.ia@gmail.com" target="_blank"
                rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">andrew.bell.ia@gmail.com</a></div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Fri, Jan 30, 2026,
              3:32 PM Daniel Baston <<a
                href="mailto:dbaston@gmail.com" target="_blank"
                rel="noreferrer" moz-do-not-send="true"
                class="moz-txt-link-freetext">dbaston@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">
                <div>Andrew,</div>
                <div><br>
                </div>
                I don't think any ship has sailed -- 3.13 will not be
                released for several months.</div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">I just meant that the API has been consistent
          for like 30 years.</div>
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">
                <div><br>
                </div>
                <div>Is there a situation where the change to client
                  code is more involved than changing "char**" to
                  "CSLConstList" ?</div>
              </div>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Yep. But it still requires users to change their
          code for little to no benefit. My general feeling is that you
          need a darn good reason to require users to change their
          existing code, but others are welcome to disagree.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">A different interface for this kind of thing
          would be nice. Perhaps something better can be done and these
          functions can be deprecated? I'm sure there are various
          options. </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div class="gmail_quote">
                <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                </blockquote>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>