[C++-sig] py++ and std::bitset

Roman Yakovenko roman.yakovenko at gmail.com
Thu Nov 30 11:08:25 CET 2006


On 11/30/06, Kirill Lapshin <kir at lapshin.net> wrote:
> Roman,
>
> Currently py++ (or, rather pygccxml) complains about std::bitset. It is
> a mere warning, and does not affect me -- I am not exposing any bitsets
> to python yet. Still I am a bit worrying that I might have such a need
> in future. It might very well be that this warning is really harmless in
> this particular case, and can be ignored.

You are right, the warning could be ignored.

> Could you verify my analysis?

Yes.

> The problem arises from _Base_bitset<size_t _Nw> that has member _WordT
> _M_w[_Nw]. Gccxml reports that max for this array is (_Nw-1) which
> pygccxml does not recognize (it expects a number).

Right. Py++ exposes static arrays. In this case it should know the
array size and
it should be integer. (Hint: outside of class definition _Nw is undefined ).

> _Base_bitset is a private base of std::bitset.
>
> I am getting warning:
> UserWarning: unable to find out array size from expression "(_Nw - 1)"
>
> I suppose that won't affect exposing bitset since it is a member of
> private base, which I don't really have (and can't) expose anyways.

Right

> Can something be done on pygccxml to support templated arrays

I think is has nothing to do with template arrays, but with expression
that defines
array size and how GCC-XML reports it. I don't know if it is possible
to change GCC-XML
to generate actual size and not the expression.

> and
> effectively remove this warning?

Yes. GCC-XML contains directory with patched header files. I think it
should be possible
to create new "bitset" "implementation", which does not introduce the problem.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list