On mardi 16 mai 2017 10:26:09 CEST Kurt Schwehr wrote: > I now know this is referred to as the "struct hack." > > This really is undefined behavior in the C++11 standard...
Well, I don't think the hack is really needed and char szLastErrorMsg[] could be replaces by a char* pszLastErrorMsg that would be malloc'ated. The current situation comes from the fact that originally no custom free function could be associated with a TLS member, but now that we have a CPLSetTLSWithFreeFunc() we could use it to free the pszLastErrorMsg member before freeing the context. (or use std::string if you prefer, but this code portion can be run under very low memory conditions, so great care is needed) -- Spatialys - Geospatial professional services http://www.spatialys.com
_______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
