[Libreoffice] [PATCH][PUSHED] Replace ENSURE_OR_* macros with regular code.

Stephan Bergmann sbergman at redhat.com
Tue Jan 24 00:30:27 PST 2012


[This should have gone out last night already, somehow didn't make it 
off my computer.]

On 01/23/2012 11:08 AM, Marcel Metz wrote:
> I oppose to the "macros improve readability" argument, these macros
> don't improve readability, they hide some regular execution from the
> programmer. You would need to know the structure of the macro to
> completely understand what the code is doing which could be a problem
> for developers that are not aware of the side effects of the macros.
> When reading the regular code the keywords that change the execution
> would stand out while the macros could easily be skipped.

Indeed, macros with hidden control flow magic are extra evil.  C++ 
offers poor abstractions in this regard, but macros overall bring more 
pain than relief, so one generally has to bite the bullet and write some 
repetitive -- albeit trivial -- boilerplate.

However, I have another question:  I notice that, while most occurrences 
are replaced with SAL_WARN, some were left as OSL_ENSURE (which I 
changed to SAL_WARN; one missed a comma, anyway) and some are changed to 
SAL_INFO.  Was there some rationale for that?  Anyway, pushed now (and 
additionally removed some newly unnecessary #include "tools/diagnose_ex.h").

Thanks,
Stephan


More information about the LibreOffice mailing list