Using conditional feature compilation/inclusion for release versioning

I have been playing with the following idea: commonly when different release series (1.0.x, 1.1.x, development code) of a product are maintained in parallel one uses different branches within a version control system to develop them. In theory though one could use feature macros (written from a C/C++ point of view, but the idea should be portable) to enable or disable particular features based on the version which is being built. In C/C++ this would most likely mean enclosing code for new features in #ifdef FEATURE_X and either enabling or disabling them on the build command line or having a master header file containing code like

#if version > 101
# define FEATURE_X
# define FEATURE_Y
#endif

Back-porting features, if one needs to do so, could be done by rearranging this file.

The idea behind this is that normally one will want to back-port fixes and improvements which are not part of significant new features to older versions unless one has a specific reason not to. However, these back-ports are often done in a rather haphazard way, resulting in unintended subtle differences between versions or forgotten fixes in certain versions. The feature macro approach reverses things, by making back-porting the default and explicitly marking code sections which are not for back-porting. While it would not be a silver bullet by any means, it might improve the level of stability which one would achieve with a given amount of testing. I would also expect it to improve code structure by forcing cleaner separation of different features.

So the question: does anyone know of real-world data about this or similar approaches?

12

It is more common to use source control branching in order to control what features are available within a particular version of the software.

That said, applications that offer tiered functionality within the same version level will sometimes use the technique you describe. Usually, you’ll see two main uses of the conditional definitions. The fist uses of the #defines declares the per-tier functionality for that tier’s build. The second usage is throughout the code where the per-tier functionality actually needs to be enabled.

In other cases, backwards compatibility on an otherwise breaking change can be maintained through the use of #defines and the application version. This gets a bit more tricky and yields less easily maintained code, but is a convenient way of keeping all the relevant code together in a single branch. The developer has to remember to revert the version number when making a special, backwards compatible build, but it does allow the older code to remain inline with the rest of the source code.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật