On Friday 06 August 2004 13:06, Aleksey Gurtovoy wrote:
Istvan Buki writes:
I modified my sample code to take advantage of your suggestion to calculate the index at compile time. It works perfectly well and the code generated is faster than my previous version but I still have questions:
1) I'm not sure if this is the right place to ask, if not somebody will certainly be able to point me into the right direction. In the assembly code generated (file attached to this mail), there are two 'call' instructions that seem useless to me. Why not inline the single 'movl' instruction executed as the result of the call? I'm using g++ 3.3.3 with O2 optimization flag and it is probably a very compiler-specific question but perhaps I'm missing something obvious here.
2) By now you probably guessed that my goal is to produce code for embedded use. In this environment standard libraries would not be available. Could you give me some idea how hard it would be to modify the mpl library not to rely on any standard include and lib?
Should be trivial -- the library has very little dependencies on the standard headers. In fact, 'std::size_t' and LONG_MAX are likely to be the only ones. You'd need to replace the default Boost config headers with your own, though, because those do depend on the presence of various std headers. Please see http://www.boost.org/libs/config/config.htm#advanced_config for the instructions on how to do that.
Indeed it was easy to do. I first created my own setup as described on the web site, starting from existing config files and then removing a couple of unknown header files in my environment. After that, the only remaining problem was the type_traits library that include the <cstddef> header in several places to have access to the definition of std::size_t. I simply created my own version of the cstddef header with the appropriate definition for std::size_t and now everything compiles. Thanks for your help, Istvan