"conversion from `int' to non-scalar type" error

Previous topic - Next topic

bigsofty

Messing around with types...

A function, within a type, that returns a type, seems to have two returns in the C++, the spare one is always "return 0", which is causing the error.

Code (glbasic) Select
// ------------------------ //
Expl Expl::Create(DGInt x, DGInt y, DGInt h)
{
   __PPRegisterFunction
REGISTER_VAR(Expl, ex);
ex.x = x;
ex.y =y;
ex.scale = h;
DIMPUSH (EXP_LIST,  ex);
return ex;
return 0; <-------------------------------------- Always added to all funcs that return a type
}
#undef __FKT
#define __FKT __g_dbg_cont


Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

OK in the next update that will be fixed. Also the warning about an unknown type when you declare them later.

bigsofty

Thanks Gernot, I converted quite a large library over to the new type system but this error was pretty much a 'show stopper'.

Cheers,


Ian
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)