I was attempting to take advantage of overloading of user-defined functions. In particular I tried to define functions with the following signatures:
matrix twoCptModel(real[] time, real[] amt, real[] rate, int[] cmt, int[] evid,
real[] CL, real[] Q, real[] V1, real[] V2, real[] ka, int ntMax)
matrix twoCptModel(real[] time, real[] amt, real[] rate, int[] cmt, int[] evid,
real CL, real Q, real V1, real V2, real ka, int ntMax)
That resulted in a compile time error indicating a non-allowable function redefinition. Apparently functions in which the arguments differ only by real vs real[] cannot be overloaded. I confirmed this with the toy functions:
real test1(real x){
return x;
}
real test1(real[] x){
return x[1];
}
They resulted in the error message:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file4623cde85c6.cpp:304:8: error: redefinition of 'test1_functor__'
struct test1_functor__ {
^
file4623cde85c6.cpp:283:8: note: previous definition is here
struct test1_functor__ {
^
This is not too hard to work around, but the ability to overload functions that differ in this way would be nice.
Cheers,
Bill