We can overload functions provided that the argument's signatures are
different. Otherwise, the generated C++ code won't compile:

error: functions that differ only in their return type cannot be overloaded

But obviously, we should report an error ("foreign functions that differ
only in their return type cannot be overloaded" ?) instead of triggering an
exception when that's not the case.

-------------------------

Yann Orlarey
Directeur scientifique
www.grame.fr



2018-03-26 11:16 GMT-07:00 Stéphane Letz <l...@grame.fr>:

>
> > Le 26 mars 2018 à 14:48, Oleg Nesterov <o...@redhat.com> a écrit :
> >
> > On 03/24, Yann Orlarey wrote:
> >>
> >> Hi,
> >>
> >> The problem has been fixed in version 2.5.26. The compiler now reports
> >> an error instead of an exception.
> >
> > and the fix is much better than I tried to suggest, thanks.
> >
> > OK, let me report another minor/trivial problem. Again, I'm not sure I
> understand
> > this code correctly, but I think that InstructionsCompiler::generateFFun()
> should
> > check 'fun_type' before it calls genDeclareFunInst(). This code
> >
> >       process = ffunction(int   func(), "",""),
> >                 ffunction(float func(), "","");
> >
> > obviously crashes faust (triggers assert in DeclareFunInst::
> DeclareFunInst()).
> >
> > OTOH, faust happily translates this code
> >
> >       process = ffunction(int func(),      "",""),
> >                 ffunction(int func(float), "","");
> >
> > into
> >
> >       output0[i] = FAUSTFLOAT(int(func()));
> >       output1[i] = FAUSTFLOAT(int(func(float(float(input0[i])))));
> >
> > probably because nerateFFun() generates the new args_types/args_value
> every time
> > without any check. This is not that bad, but perhaps not right anyway.
> >
> > Oleg.
>
>
> The DeclareFunInst causes this assert if functions with the same name but
> different prototypes are used. This is probably not correct !?
>
> Yann are we supposed to be able to use several « foreign functions with
> the same name but different prototypes » ? Or at least coming from
> different header files? If not then I guess this could/should be checked
> before the FIR generation step and the use of DeclareFunInst.
>
> Stéphane
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
Faudiostream-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to