C IDEs: preprocessor-aware code navigation -


background

i spend lot of time navigating , editing convoluted scientific c codes. contain hundreds of optional features switched on , off preprocessor directives. makes impossible @ glance whether current block of code activated in current setup or not. code not every feature smudged on place , done using global variables.

question

is there ide can handle preprocessor directives folding/shading inactive code?

i imagine 1 can maintain project config of used flags , work not being bothered inactive branches of logic.

looking @ similar question seems eclipse cdt has functionality need , the other question tells can set ifdefs.

emacs has similar in form of hide-ifdef-mode.

but can try use ide-agnostic solution running code through unifdef , working result. if need read code, it's perfect solution. if need make changes, things become bit more complicated, can use git manage changes, like:

  • import whole code base git
  • run through unifdef
  • commit result, that's basis patches
  • work code base in whatever ide/editor prefer, commiting changes usual
  • if there need produce patches original code base, checkout original import commit , cherry-pick (or rebase) patches branch (of course there chance conflict, should quite easy resolve know intended change code patch , need adjust ifdefs)
  • if there need update code base, start original import, apply update, commit that, run through unifdef, commit , rebase changes on top of that

of course, whether approach work or not depends on particular code base , you're going it, can useful in scenarios.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -