Boost logo

Boost :

Subject: Re: [boost] BOOST_PP array extension proposal
From: Edward Diener (eldiener_at_[hidden])
Date: 2015-09-13 21:15:12


On 9/13/2015 12:29 PM, Gruenke,Matt wrote:
> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Edward Diener
> Sent: Thursday, September 10, 2015 17:11
>
>> Given that variadic macros are supported for just about all compilers now,
>
> Out of curiosity, do you mean all C++ compilers or all C compilers?

I did mean C++ compilers but variadic macros were officially added to C
compilers with C99, which was even before they were officially added to
C++ compilers.

>
> The reason I ask is that I've made a C equivalent of STL, using Boost PP. It's just a proof of concept, at this stage (only a few containers and algorithms implemented, so far). It was originally intended for OpenCL kernels, but since C++ support was added in 2.1, it seemed pointless to pursue that objective. However, there are still plenty of pure C codebases out there, and having had to work in a couple, I'd been yearning for the power and convenience of STL.
>
> It's still my intention to clean up and release it for C, someday. I realize that this probably falls outside the scope of BOOST_PP, and certainly the larger Boost project. But if/when I do release it, I'd like to retain the broadest compiler compatibility, as many C projects are legacy code for legacy platforms (with legacy tools) and would prefer not to force users to track down and install an old version of BOOST_PP.

I have no intention of turning on varaidic macro support for all
compilers in Boost PP and I doubt if Paul does either. The end-user can
always turn on variadic macro support for a compiler by defining
BOOST_PP_VARIADICS=1 before including Boost PP headers. And yes, Boost
PP works for C compilers as well as C++ compilers.

>
> BTW, is anyone aware of such a library already in existence?

if by STL you mean the C++ standard template library I can not imagine
how you could do that in straight C.

>
>
> Thanks for all the great work that went into BOOST_PP. Before running across it, I never knew the humble C preprocessor was so capable.

If it wasn't for VC++, whose preprocessor is decidedly non-standard, as
well as a few other compilers which do attempt to implement a C++
standard preprocessor but have some subtle bugs, Boost PP would be much
easier to program and even more capable. Paul's Chaos library is an
example of what could be done if you don't have to deal with
non-conforming C/C++ preprocessors and you are also a genius at writing
macros.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk