[gdal-dev] Use of CPLAssert macro

Jorge Arévalo jorge.arevalo at gmail.com
Thu Jul 16 06:12:09 EDT 2009


Hello,

Please, correct me if I'm wrong:

The CPLAssert macro should be used only to report errors that force
application to abort, like when we can't read a raster band, for
example. For errors that only has sense in the context of the code
that we're developing, we may perform a "common" error checking and,
if fails, call CPLError with the severity needed (CE_Failure...).

I mean, if in my code (GDAL WKT Raster driver), I only want to read
raster with regular_blocking arrangement, for example, this isn't an
"error", but I want to force a fail, and abort. Then, I check the
arrangement, and call CPLError if fails.

Am I right? Is this the point to difference between calling CPLAssert
and check the error by myself and call CPLError?

Thanks in advance

Best regards,
Jorge


More information about the gdal-dev mailing list