← Back to team overview

kicad-developers team mailing list archive

Re: SVN revs greater than 1753 require bootst 1.36


Wayne Stambaugh wrote:
Brian Sidebotham wrote:

2009/5/9 Wayne Stambaugh <stambaughw@...>:

hvontres@... wrote:

Svn rev 1753 introduced the use of BOOST_REVERSE_FOREACH in cvframe.cpp Unfortunately this does not build on my Ubuntu 8.04 machine which is still stuck with boost 1.34. It looks like the minimum version of boost is now 1.36. This should either be fixed or documented someplace.

I knew this would eventually be an issue. It appears that I will be one
who has to raise the question. What should be the minimum version of
Boost that Kicad supports? I am using 1.36 on all of my machines and
the current release version is 1.39. I will remove BOOST_FOREACH and
BOOST_REVERSE_FOREACH and fall back to ptr_vector::interator and
ptr_vector::reverse_iterator if support for Boost versions less then
1.36 required. I guess switching from wxList to boost::ptr_vector was
not as easy as I had expected. Ah, no good deed goes unpunished ;)

I will be without email for the next few days due to travel so I will
not be able to commit any fixes until Tuesday at the earliest.


I just updated boost on my dev PC. I don't think it is unreasonable to
require developers to have certain minimum versions of the libraries
KiCad rely's on, if improving the codebase means requiring a more
recent version, then the new version should just be noted as required.
At the moment COMPILING.TXT mentions 1.34 as the minimum, I would say
this just needs changing to 1.36. At the moment 1.39 is current, so it
is not like the 1.34 requirement is up with the times.


I missed the Boost version in COMPILING.TXT. Obviously, I would prefer
to bump the Boost version 1.36. Not just because I don't want to change
the code to use vector iterators, but because BOOST_FOREACH makes for
much cleaner code. I stumbled upon <boost/foreach.hpp> by accident when
I was looking at the documentation for ptr_vector. The BOOST_FOREACH
macro hides the vector iterator for() loop. If you look at the code
sample for BOOST_FOREACH, you can see how much cleaner the iterator
block is compared to using the typical vector iterator in a for loop.

If everyone is OK with the version bump, I will see if the cmake
FindBoost macro can be used to set a minimum version of the Boost library.


Has anyone verified that the C++ compiler is able to optimize this macro down to something concise? It would be interesting to look at object file size or resultant program size to confirm this. Just as an observation, this macros asks quite a lot of the compiler to achieve this result. It is like boiling an egg until all the water is gone. I am not opposing FOREACH's use. But I am not the kind of guy that just gets in line to drink the cool aid without asking what's in it. Here is the macro's source, actually just a fraction of it, because I am not showing BOOS_FOREACH_PREAMBLE(), BOOST_FOREACH_ID, BOOST_FOREACH_DEREF, nor BOOST_FOR_EACH_DONE.


BOOST_FOREACH_PREAMBLE() \ if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_col) = BOOST_FOREACH_CONTAIN(COL)) {} else \ if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_cur) = BOOST_FOREACH_BEGIN(COL)) {} else \ if (boost::foreach_detail_::auto_any_t BOOST_FOREACH_ID(_foreach_end) = BOOST_FOREACH_END(COL)) {} else \ for (bool BOOST_FOREACH_ID(_foreach_continue) = true; \ BOOST_FOREACH_ID(_foreach_continue) && !BOOST_FOREACH_DONE(COL); \ BOOST_FOREACH_ID(_foreach_continue) ? BOOST_FOREACH_NEXT(COL) : (void)0) \ if (boost::foreach_detail_::set_false(BOOST_FOREACH_ID(_foreach_continue))) {} else \ for (VAR = BOOST_FOREACH_DEREF(COL); !BOOST_FOREACH_ID(_foreach_continue); BOOST_FOREACH_ID(_foreach_continue) = true)

If the compiler can boil this down, and there is not a huge compile time cost, then this seems reasonable to use.
But somebody should take the time to verify this if it has not been done.


Follow ups