|
|
|
|
|
by CyberDildonics
1844 days ago
|
|
This is one of the few comments in this entire thread that I think is interesting and born out of a lot of experience and not cargo culting. In C++ you can make a macro function that takes any number of arguments but does nothing. I end up using that to label a scope because that scope block will then collapse in the IDE. I usually declare any variables that are going to be 'output' by that scope block just above it. This creates the ability to break down isolated parts of a long function that don't need to be repeated. Variables being used also don't need to be declared as function inputs which also simplifies things significantly compared to a function. This doesn't address making the compiler enforce much, though it does show that anything declared in the scope doesn't pollute the large function it is in. |
|
I wish more IDEs had the ability to chunk code like this on-the-fly. I think it's technically possible, and maybe even possible to insert artificial blocks automatically, showing you how your code layout chunks automatically... Hmm.
You know, once I'm less busy I might try implementing something like this.