Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I correctly version a program? [closed]

I always see programs that say things like, Version: 1.5.6, or something. My question is, how do I properly determine the version?

I'm a C++ programmer, so I would think this is kind of important. I also use Visual Studio Ultimate 2012.

EDIT: How do I add the version in the code as well?

like image 206
Tux Avatar asked Nov 03 '12 13:11

Tux


2 Answers

There is no real standard or anything, but this is the general practice:

  • The leftmost number represents the "most major" number, meaning it's incremented when the software changes a lot, always upon breaking changes.

  • The rightmost number represents the "most minor" number, meaning it's incremented every time the program is released. This is good for changes like bugfixes.

  • The numbers in-between simply cover changes of medium importance, e.g. non-breaking, yet large changes like a major bugfix.

  • Whenever a number is changed the numbers to the right are reset to 0

  • 1.X marks the first usable version, 0.X can be seen as beta/alpha versions

like image 166
Pubby Avatar answered Nov 09 '22 17:11

Pubby


normally you place the version in a VersionInfo record in the .rc of your project that way the version number will be known by the system e.g. when copying a file.

If you need the version number inside your program as well then the simplest way is to create a header where you have defines with the version number

#define VER_FILEVERSION             1,0,0,0
#define VER_FILEVERSION_STR         "1.0.0.0\0"

#define VER_PRODUCTVERSION          1,0,0,0
#define VER_PRODUCTVERSION_STR      "1.0\0"

then include that header in both the .rc file as well as in the file where you need it.

like image 1
AndersK Avatar answered Nov 09 '22 16:11

AndersK