<br><br><div><span class="gmail_quote">On 02/06/2008, <b class="gmail_sendername">Hans Meine</b> &lt;<a href="mailto:meine@informatik.uni-hamburg.de">meine@informatik.uni-hamburg.de</a>&gt; 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>&gt; &gt; The gccxml module does not seem to recognize the &quot;short&quot; return value:<br> &gt; &gt; .../word.h:6: Warning: Return value &#39;short int&#39; error (used in Word::word<br>
 &gt; &gt; [variable]): TypeLookupError(&#39;short int&#39;,)<br> &gt; &gt;&nbsp;&nbsp; short word;<br> &gt; &gt;<br> &gt; &gt; However, when looking at pybindgen/typehandlers/inttype.py, fixing this<br> &gt; &gt; seems<br> &gt; &gt; to be possible, but I wonder if a more general approach than adding one<br>
 &gt; &gt; class<br> &gt; &gt; for each combination of const/ptr/ref/unsigned/width integer type would<br> &gt; &gt; be more sensible?<br> &gt;<br> &gt;&nbsp;&nbsp;I&#39;m not sure.&nbsp;&nbsp;Maybe it&#39;s possible to find a common base class for all<br>
 &gt; int-like types.<br> <br> <br>That could be a start.&nbsp;&nbsp;Right now, I wonder<br> - why some CTYPES contain &#39;int&#39;, but not &#39;int32_t&#39;, some the other way round,<br> some both<br> - why some CTYPES contain variants with &quot;const&quot; postfixes, but quite randomly<br>
 AFAICS<br> - why UInt8PtrParam has &quot;uint8_t const *&quot; 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.&nbsp; If you really care about this issue (personally I don&#39;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;"> &gt; &gt; Finally, the anonymous struct inside the union is not yet<br> <br>&gt; &gt; supported.&nbsp;&nbsp;[...]<br>
 <br>&gt;<br> &gt; Ugh.. right, I guess it&#39;s a bug.&nbsp;&nbsp;But I am curious, how do you access<br> &gt; anonymous structures from C?&nbsp;&nbsp;It does not seem possible, unless I am<br> &gt; 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?&nbsp;&nbsp;From your question, I fear pybindgen.gccxmlparser would<br> need to be extended to support template instances, too?!&nbsp;&nbsp;(And probably a<br>
 switch to write extern &quot;C&quot; 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>
 &nbsp; &nbsp; &nbsp; &nbsp;short word;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;struct<br>
 &nbsp; &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;char low, high;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;};<br>
};<br><br>Word foo;<br><br>What would be the C++ code that accesses the field &#39;low&#39; from inside &#39;foo&#39;?&nbsp; I honestly have no idea.<br>&nbsp;</div></div>-- <br>Gustavo J. A. M. Carneiro<br>INESC Porto, Telecommunications and Multimedia Unit<br>
&quot;The universe is always one step beyond logic.&quot; -- Frank Herbert