<br><br><div><span class="gmail_quote">On 02/06/2008, <b class="gmail_sendername">Hans Meine</b> <<a href="mailto:meine@informatik.uni-hamburg.de">meine@informatik.uni-hamburg.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am Sonntag, 01. Juni 2008 22:09:45 schrieb Gustavo Carneiro:<br> <br>> > The gccxml module does not seem to recognize the "short" return value:<br> > > .../word.h:6: Warning: Return value 'short int' error (used in Word::word<br>
> > [variable]): TypeLookupError('short int',)<br> > > short word;<br> > ><br> > > However, when looking at pybindgen/typehandlers/inttype.py, fixing this<br> > > seems<br> > > to be possible, but I wonder if a more general approach than adding one<br>
> > class<br> > > for each combination of const/ptr/ref/unsigned/width integer type would<br> > > be more sensible?<br> ><br> > I'm not sure. Maybe it's possible to find a common base class for all<br>
> int-like types.<br> <br> <br>That could be a start. Right now, I wonder<br> - why some CTYPES contain 'int', but not 'int32_t', some the other way round,<br> some both<br> - why some CTYPES contain variants with "const" postfixes, but quite randomly<br>
AFAICS<br> - why UInt8PtrParam has "uint8_t const *" in CTYPES and DIRECTION_OUT in<br> DIRECTIONS<br> - why signed values are only value-checked for the upper, but not the lower<br> bound, at least in the places I saw<br>
<br> Maybe the whole file should be generated by a script, e.g. from a template for<br> N bits, that would still make eight hand-written classes AFAICS (e.g.<br> {Unsigned,}Int{{,Ref,Ptr}Param,Return} ) which seem to be hard enough to get<br>
right..</blockquote><div><br>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?<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> > > Finally, the anonymous struct inside the union is not yet<br> <br>> > supported. [...]<br>
<br>><br> > Ugh.. right, I guess it's a bug. But I am curious, how do you access<br> > anonymous structures from C? It does not seem possible, unless I am<br> > missing something, and if so, what would be the point in wrapping them?<br>
<br> <br>I would simply compile the generated code with g++ instead of gcc, or am I<br> missing something? From your question, I fear pybindgen.gccxmlparser would<br> need to be extended to support template instances, too?! (And probably a<br>
switch to write extern "C" around the module init function.)</blockquote><div><br>Maybe is my lack of knowledge of some C++ dark corner, but:<br><br><br>
union Word<br>
{<br>
short word;<br>
struct<br>
{<br>
char low, high;<br>
};<br>
};<br><br>Word foo;<br><br>What would be the C++ code that accesses the field 'low' from inside 'foo'? I honestly have no idea.<br> </div></div>-- <br>Gustavo J. A. M. Carneiro<br>INESC Porto, Telecommunications and Multimedia Unit<br>
"The universe is always one step beyond logic." -- Frank Herbert