Tom et al.,

I just committed a pretty substantial reworking of our API to not only support 
run-time versioning but also compile-time.  We've already discussed the topic 
at length before including my reservations (which I don't want to rehash, I 
acquiesce fully), so I wanted to at least announce that this interface now 
exists and get people's feedback.

I took a slightly different approach than the one you'd implemented earlier 
which collapsed the version into an integer.  The approach I'm proposing here 
is a semantic one that lets you build up preprocessor logic to match a given 
revision range.  For example

#if BRLCAD_API(7,24,0)
... do something that should compile with 7.24.0 or earlier
#elif BRLCAD_API(7,26,0)
... do something that should compile with 7.24.1 through 7.26.0
#else
... do something that should compile with 7.26.1+
#endif

This mirrors how a couple other popular APIs provide versioning and has a few 
nice properties.  The way this is intended to work in practice is that 3rd 
party codes can add a BRLCAD_API() check for any/each obsolete entry in the 
CHANGES file (by putting the version where something last existed).  This way, 
the unadorned #else case is always the latest API.

That is intentional, so the code doesn't have some embedded maintenance cost 
(unless the API further changes) to simply track the latest API.   Of course, 
you can also add !BRLCAD_API() (notice the "!") to get reverse behavior -- 
matching API that comes *after* a given revision -- but that is more useful for 
testing an isolated range of revisions.  E.g.,

#if !BRLCAD_API(7,24,0) && BRLCAD_API(7,26.0)
... should compile with 7.24.1 through 7.26.0, something temporary was 
introduced
#else
... API without that temporary mess
#endif

Let me know if this is a workable solution for your use case.  This was one of 
the last bigger issues remaining on the RELEASE branch, so I'm hopeful.  One 
final related note for everyone ... this new compile-time API should NOT be 
used in our own code!  Probably need some means to enforce this...  Anyone want 
to try adding it to regress/repository.sh?

Cheers!
Sean


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to