Supporting more than one codebase in ANSI-C
Posted
by
Ilker Murat Karakas
on Stack Overflow
See other posts from Stack Overflow
or by Ilker Murat Karakas
Published on 2011-03-07T07:59:49Z
Indexed on
2011/03/07
8:10 UTC
Read the original article
Hit count: 296
I am working on a project, with an associated Ansi-C code base. (let me call this the 'main' codebase).
I now am confronted with a typical problem (stated below), which I believe I would be able to solve much easily if I had an object-oriented language at hand.
The problem is this: I will have to start more than one codebases; i.e. I will have to start supporting a parallel codebase (even maybe more in the future). The initial codebases for all the new (i.e. parallel) codebases will initially be identical as the old (i.e. 'main') codebase.
As we are talking about the 'C' language, I have till now been thinking of adding '#ifdef' statements to code, and writing the branch-spacific code inside those 'ifdef' blocks.
Hoping that I made the problem clear (enough!), I would like to hear thoughts on clever patterns that would help me handle this problem elegantly in Ansi C.
Cheers
© Stack Overflow or respective owner