On Thu, Jul 20, 2017 at 05:17:01PM +0200, zyx wrote: > Hi, > > On Thu, 2017-07-20 at 15:30 +0200, Joerg Sonnenberger wrote: > > Passing anything to Load() which was not explicit a long, i.e. > > std::string::size() would result in the former method be choosen... > > Ah, I see, that's unfortunate and unintended. The idea behind the > change was to not break the API, as I hope you understand. The only > feasible option is to remove the default value for the variant with the > buffer, I guess. The thing is that I doubt that having: > > Load(const char *); > Load(const char *, bool); > Load(const char *, long); > Load(const char *, long, bool); > > would make any real difference when using only two arguments, where the > second would not be explicit 'long', just the same as it does now.
Whether the second or third is choosen still depends on the conversion rules, which is tricky at best. The best approach would be to actually distinguish between "Load from file" and "Load from buffer" with separate interfaces, potentially just supporting native C++ types like std::string at the same time (or C++17: std::stringview). Don't get me wrong, I'm not saying someone wanted to maliciously break existing code in subtile ways. But this is kind of the poster child for bad function overloading... Joerg ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users