[C++-sig] ANNOUNCE: PyBindGen 0.8
Gustavo Carneiro
gjcarneiro at gmail.com
Tue Jun 3 02:08:21 CEST 2008
On 02/06/2008, Hans Meine <meine at informatik.uni-hamburg.de> wrote:
>
> Am Sonntag, 01. Juni 2008 22:09:45 schrieb Gustavo Carneiro:
>
> > > The gccxml module does not seem to recognize the "short" return value:
> > > .../word.h:6: Warning: Return value 'short int' error (used in
> Word::word
> > > [variable]): TypeLookupError('short int',)
> > > short word;
> > >
> > > However, when looking at pybindgen/typehandlers/inttype.py, fixing this
> > > seems
> > > to be possible, but I wonder if a more general approach than adding one
> > > class
> > > for each combination of const/ptr/ref/unsigned/width integer type would
> > > be more sensible?
> >
> > I'm not sure. Maybe it's possible to find a common base class for all
> > int-like types.
>
>
> That could be a start. Right now, I wonder
> - why some CTYPES contain 'int', but not 'int32_t', some the other way
> round,
> some both
> - why some CTYPES contain variants with "const" postfixes, but quite
> randomly
> AFAICS
> - why UInt8PtrParam has "uint8_t const *" in CTYPES and DIRECTION_OUT in
> DIRECTIONS
> - why signed values are only value-checked for the upper, but not the lower
> bound, at least in the places I saw
>
> Maybe the whole file should be generated by a script, e.g. from a template
> for
> N bits, that would still make eight hand-written classes AFAICS (e.g.
> {Unsigned,}Int{{,Ref,Ptr}Param,Return} ) which seem to be hard enough to
> get
> right..
OK, this is all very abstract, and kind of beside the point. If you really
care about this issue (personally I don't care that much, but...) could you
open a bug report so we can stop bothering these nice c++-sig folks?
> > Finally, the anonymous struct inside the union is not yet
>
> > > supported. [...]
>
> >
> > Ugh.. right, I guess it's a bug. But I am curious, how do you access
> > anonymous structures from C? It does not seem possible, unless I am
> > missing something, and if so, what would be the point in wrapping them?
>
>
> I would simply compile the generated code with g++ instead of gcc, or am I
> missing something? From your question, I fear pybindgen.gccxmlparser would
> need to be extended to support template instances, too?! (And probably a
> switch to write extern "C" around the module init function.)
Maybe is my lack of knowledge of some C++ dark corner, but:
union Word
{
short word;
struct
{
char low, high;
};
};
Word foo;
What would be the C++ code that accesses the field 'low' from inside 'foo'?
I honestly have no idea.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080603/be4f6ba3/attachment.htm>
More information about the Cplusplus-sig
mailing list