Boost logo

Boost :

Subject: Re: [boost] [Math.Constants] Help needed with the preprocessor
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2011-12-17 12:22:11

> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On Behalf Of John
> Maddock
> Sent: Saturday, December 17, 2011 4:35 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] [Math.Constants] Help needed with the preprocessor
> >> Either way, I'd really like to find something that's actually
> >> guaranteed to work, rather than just happens to :-(
> >
> > I don't know if this help or is accepted Boost practice, but as a last
> > resort, couldn't you generate the necessary header files through some
> > scripting language?
> Nod. That's the last resort! ;-)

Since the net effect is to generate C++ class (struct) definitions for each constant,
we could also write a C++ program that would generate them to fully write all or part of the
constants.hpp file.
This method was used for the previous math constants submission. It was tedious to write.

We would have to fix the precision (but that's done already - currently 100 decimal digits).

This would write a much larger constants.hpp file, but users would not be pre-processing at compile
time (something that might become a concern if too many constants are being generated, forcing us to
split into multiple files).

I have no idea about the relative speed of making the pre-processor work hard versus reading a
larger C++ header file.

However, since the docs and everything is almost ready-to-go, it would be *very* nice to find a
quick fix and have to refactor big-time!

So useful suggestions still most welcome :-)


Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204

Boost list run by bdawes at, gregod at, cpdaniel at, john at