In semantic versioning the general rule is to increase the minor number only when backwards compatible functionalities are introduced, otherwise the major number must be increased instead. The same approach, but with a different arithmetic, is used by libtool.
I have a question concerning what is considered a backwards compatible change and what not.
Imagine I have written a library, and the public header of this library contains a typedef
of a data type named foo
. In version 1.0.0 this typedef
looks like this:
typedef struct foo_t {
int x;
int y;
} foo;
Then I decide to change the data type, and in the next version it will look like this:
typedef struct foo_t {
int x;
int y;
int z;
} foo;
I have only added one field to the structure foo_t
. It would seem to be a backward compatible change, however the structure above is de facto another structure now. What I have done was not introducing a new function and leave untouched all the rest, but instead I have changed something that was already there.
The data type above is normally used for exchanging data with the library's functions, however the user might have used it with other purposes. If the user had written a program using version 1.0.0 and the last change constitutes a backward compatible change, the user's program must compile also with this new version.
How will this new version be called, 1.1.0 or 2.0.0?
EDIT
You can read further developments of this discussion here.