[PATCH] version.h: Add version check macro
Bill Spitzak
spitzak at gmail.com
Mon Sep 30 09:42:13 PDT 2013
On 09/29/2013 02:56 PM, Kristian Høgsberg wrote:
> No, we don't guarantee plugin API compatiblity from 1.2 to 1.3. We
> may remove functions, structure fields, or change how existing
> functions work between 1.x versions. There is no guarantee your
> plugin will work or even compile with 1.3 even if it works with 1.2,
> but it will work with every later 1.2.x release. That's why I made
> the change to the version check macro.
Yes I understand that. My complaint is that while you *may* remove
something between 1.2 and 1.3, you *probably won't*.
Therefore somebody using a feature that appeared in 1.2.5 and never
disappears, and is now trying to compile for 1.8.3, has to write:
#if WESTON_VERSION_AT_LEAST(1,2,5) || \
WESTON_VERSION_AT_LEAST(1,3,0) || \
WESTON_VERSION_AT_LEAST(1,4,0) || \
WESTON_VERSION_AT_LEAST(1,5,0) || \
WESTON_VERSION_AT_LEAST(1,6,0) || \
WESTON_VERSION_AT_LEAST(1,7,0) || \
WESTON_VERSION_AT_LEAST(1,8,0)
...
And when 1.9.0 comes out they have to add another statement to the
above! The only "advantage" is that if the feature happens to vanish in
1.9.0 then they don't have to edit the source. But in reality the reason
it would vanish is because 1.9.0 is providing a new and better way to
get the desired function, so they will want to edit the source anyway to
add this.
In my (and I suspect a lot of other people's) proposed version the
programer just writes:
#if WESTON_VERSION_AT_LEAST(1,2,5)
If in fact the feature vanishes in 1.9.0 then they can write:
#if WESTON_VERSION_AT_LEAST(1,2,5) && !WESTON_VERSION_AT_LEAST(1,9,0)
In the very likely case that 1.9.0 actually wants to use some new
feature and not the fallback for the really old version:
#if WESTON_VERSION_AT_LEAST(1,9,0)
... new better api is used ...
#elif WESTON_VERSION_AT_LEAST(1,2,5)
... use the feature ...
#else
... fallback for very old version...
#endif
More information about the wayland-devel
mailing list