Skip to content

Conversation

@MichaelChirico
Copy link
Contributor

Following up the tidyteam meeting today with a first suggested PR as an earmark/test balloon lest I forget. A few notes:

  1. We could also consider fully "modularizing" by splitting up the sources into .h, .cpp pairs, where the .h file declares the routines and gives some documentary comments, and the .cpp file gives the implementations. Often, this further cleans up the inclusions by making clear what's needed for the API aspect of the routines (input/return types, etc.) vs. what's required for the implementation. Omitted this for now as it's a bit more involved / not sure preferences.
  2. <cstddef> for NULL gave me a bit of pause because src/init.c uses <stdlib.h> for that. I think this is partly just a C vs. C++ thing, e.g. https://stackoverflow.com/q/12023476/3576984; we might consider <stddef.h> for a narrower inclusion in init.c.
  3. If you'd like me to play around with getting this enforced in GHA, let me know. IINM it's https://clang.llvm.org/extra/clang-tidy/checks/misc/include-cleaner.html.
  4. I added the annotations of which header gives which symbol (1) for easier review and (2) to match a few other files like src/xml2_doc.cpp. The risk is that these annotations fall out of sync with the actual code over time.
  5. Some style guides recommendation around the order to use for inclusions (e.g.). I'm indifferent here and didn't make any changes, besides that my new inclusions here are roughly alphabetized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant