2021.01.15 23:32 "[Tiff] MergeRequest for discussion code style", by Kurt Schwehr

2021.01.15 23:32 "[Tiff] MergeRequest for discussion code style", by Kurt Schwehr

Hi all,

I just created https://gitlab.com/libtiff/libtiff/-/merge_requests/204 with the goal of seeing what the community thinks of various changes. This is similar to what I did with GDAL long ago, but that was mostly C++. My C99 is rusty, so I might have made some blunders.

I picked tools/tiffsplit.c because it's not too complicated.

I did find one surprise in that tiffsplit currently returns EXIT_SUCCESS (aka 0) if you pass it a file it can't open. My merge request flips that to return EXIT_FAILURE (aka 1) if it can't open the file. e.g. in bash

tiffsplit /does/not/exist
echo $?

Thoughts on these changes?

Do keep in mind that I work at Google, so I'm come at this as someone who spends a lot of time in the Google C++ style guide. https://google.github.io/styleguide/cppguide.html. There are many style guides around for C and C++... they all have tradeoffs and I find it useful call out when the assumptions and requirements between style guides differ. (e.g. Google doesn't use C++ exceptions which other folks can't live without)

Cheers,
-kurt