Menu

#40 function pointers

open
nobody
None
2
2007-05-23
2007-05-22
ohhappyshen
No

The return type of "get" method of "std::map" is not translated correctly.

The error information is following.

[javac] /home/jieshen/work/xbig/trunk/tests/Ogre3D/build/java/org/xbig/Ogre/CompositorScriptCompiler.java:101: <identifier> expected
[javac] public void(CompositorScriptCompiler::*) get(Integer key) {
[javac] ^
[javac] /home/jieshen/work/xbig/trunk/tests/Ogre3D/build/java/org/xbig/Ogre/CompositorScriptCompiler.java:101: <identifier> expected
[javac] public void(CompositorScriptCompiler::*) get(Integer key) {

Discussion

  • Christoph Nenning

    Logged In: YES
    user_id=1568577
    Originator: NO

    See t13_? for std::map. In many cases it is correct. Please provide the typedef for which this error occurs.

     
  • ohhappyshen

    ohhappyshen - 2007-05-23

    Logged In: YES
    user_id=1385755
    Originator: YES

    The typedef as follows:x

    typedef std::map<size_t, CSC_Action> TokenActionMap;

     
  • Christoph Nenning

    Logged In: YES
    user_id=1568577
    Originator: NO

    CSC_Action is defined as follows:
    typedef void(CompositorScriptCompiler::* Ogre::CompositorScriptCompiler::CSC_Action)

    CompositorScriptCompiler::* is not handled, so it is used in Java.
    I think we should put Ogre::CompositorScriptCompiler::TokenActionMap on ignore_list.

     
  • ohhappyshen

    ohhappyshen - 2007-05-23

    Logged In: YES
    user_id=1385755
    Originator: YES

    >CompositorScriptCompiler::* is not handled, so it is used in Java.
    I don't quite understand what you mean.

    CSC_Action is defined as follow:
    typedef void (CompositorScriptCompiler::* CSC_Action)(void);

    So i think it's a function pointer.

     
  • Christoph Nenning

    Logged In: YES
    user_id=1568577
    Originator: NO

    Oh yes, it is a function pointer, I didn't realize this. Function pointers are not handled. So "CompositorScriptCompiler::*" is used as type in meta. This type cannot be resolved and thus it is just copied to Java Code. I think we should ignore std::maps which contain function pointers. Anyway, how should be map a function pointer to Java?

     
  • ohhappyshen

    ohhappyshen - 2007-05-23

    Logged In: YES
    user_id=1385755
    Originator: YES

    yes, i also think we can ignore it before we finish other features needed by OGRE.

     
  • Christoph Nenning

    • priority: 5 --> 2
    • summary: The return type of "get" method of "std::map" is wrong --> function pointers
     

Log in to post a comment.

MongoDB Logo MongoDB