fonta.romain Posted October 10, 2012 Share Posted October 10, 2012 Hello ! Today I made some tests with "call" function. Look at the code below (could be pasted in a new world for tests) : void test(int a, int b, int c = 42) { log.message("Called -- " + string(a) + " -- " + string(B) + " -- " + string(c) + "\n") ; } int init() { test(12, 24, 48) ; test(12, 24) ; call("test", 12, 24, 48) ; call("test", 12, 24) ; return 1 ; } The result is : - First three calls OK - Last one crash 10:09:10 Called -- 12 -- 24 -- 48 10:09:10 Called -- 12 -- 24 -- 42 10:09:10 Called -- 12 -- 24 -- 48 10:09:10 Machine::do_callfd(): cant find "test" function with 2 arguments 10:09:10 Stack dump: 10:09:10 0x0000: int: 12 10:09:10 0x0001: int: 24 10:09:10 Call stack: 10:09:10 00: 0x00000026 init() 10:09:10 Disassemble: 10:09:10 0x0000004a: callfd 2 10:09:10 0x0000004d: pop 10:09:10 0x0000004e: pushc int: 1 10:09:10 0x00000050: ret 10:09:10 0x00000051: pushc int: 0 10:09:10 World::loadWorld(): world init function return 0 in "Airbus.cpp" file It seems that the default argument value is not taken into account, is this the desired behavior or a bug ? Thank you ! Link to comment
manguste Posted October 22, 2012 Share Posted October 22, 2012 With call() you cannot use predefined arguments. They cannot be parsed and the interpreter simply does not find a function with the required number of arguments. Link to comment
fonta.romain Posted October 23, 2012 Author Share Posted October 23, 2012 Thanks, its clear ! Link to comment
Recommended Posts