oricutron icon indicating copy to clipboard operation
oricutron copied to clipboard

Self contained headers / include files

Open 0ric1 opened this issue 8 years ago • 5 comments

Is there an interest in changing the headers so that they are self-contained (should include all other headers it needs) and get rid of the inclusion chaos in the .c files? Especially machine.h, where e.g. include symboltable, telebankinfo, via, ... is missing - only keyboard.h is included.

programmer_defined_includes

0ric1 avatar Jun 14 '16 21:06 0ric1

Yeah, its a mess. I actually started on a completely new codebase for Oricutron 2.0, because of the mess that the 1.x code had become, but in reality I just don't have the time or energy to devote to a rewrite, so if you want to tackle cleaning up the 1.x codebase, go for it with my blessing..

pete-gordon avatar Jun 14 '16 21:06 pete-gordon

Now the graph looks much nicer.

programmer_defined_includes

0ric1 avatar Jun 15 '16 17:06 0ric1

Hallo Blonder, nice graph - well done! Here are some comments from me:

  • the usage of _MSC_VER - it's bit overdosed for me ;). If look closer all #if(n)def _MSC_VER are followed by #include "system.h" - I think it will be better to move all _MSC_VER related stuff to "system.h" (which contains exactly platform dependent code) - so it would be easier to maintain the code and "msvc/*.h" can be removed.
  • in "main" function you call "_CrtSetDbgFlag" before definition of the local variables - this is more like C++ and not C.
  • avoid using single (and even double) backslashes ('') in #include - this can lead to hard-to-find errors on non windows target platforms.

Above notes are just only my private humble opinion. Cheers!

iss000 avatar Jun 15 '16 20:06 iss000

Hello iss000, "nice graph - well done!" - thanks.

  • ... are followed by system.h - this is no longer the case in my code, I eliminated nearly all includes by moving the most of them to the location where they are needed - into machine.h (see the new graph), But I can move it into system.h, it's included by machine.h.
  • "main" : correct, didn't notice the oric and isinit variables, wanted the crt... call on the top of main, to find all leaks. Moved it now behind, but I can also remove it completely, because all known leaks are fixed.
  • ('') I will replace with ('/') I was thinking c++1x Thanks for the notes.

0ric1 avatar Jun 15 '16 21:06 0ric1

Graph now looks better.:

programmer_defined_includes

0ric1 avatar Jun 15 '16 22:06 0ric1