11

Which c++ compiler can compile next code?

void (*G2API_CopyGhoul2Instance)(CGhoul2Info_v &ghoul2From, 
                                 CGhoul2Info_v &ghoul2To, 
                                 int modelIndex = -1); //<--- That's it!

It is not my code and I have a lot of such things. I know that standart didn't allow such declaration, but this comment tells me that some compilers allow it.

P.S. This code from Star Wars Jedi Knight: Jedi Academy source.

1
  • 1
    Looks like something we'd do with std::function/std::bind today. Alternatively, it's easily wrapped in a custom functor, and operator() can have default parameters. Commented Apr 5, 2013 at 16:19

2 Answers 2

3

Can't suggest the compiler though I've found a useful link which lists out the fixes that are required to the code to successfully compile it with GCC compiler.

http://www.lucasforums.com/showthread.php?t=203922

Hope it is useful to you.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot, but there is no answer for my trouble at this link. As I understood they tried to compile some sort of development kit for JKA. In my case it's not SDK it is whole JKA (almost whole).
0

g++ v11.4 compiles that. The only thing is you should add -fpermissive parameter:

$ g++ -fpermissive x.cpp 
x.cpp:7:49: warning: default arguments are only permitted for function parameters [-fpermissive]
    7 |                                  int modelIndex = -1); //<--- That's it!
      |                                                 ^

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.