Author Topic: "conversion from `int' to non-scalar type" error  (Read 2166 times)

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
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)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10814
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
OK in the next update that will be fixed. Also the warning about an unknown type when you declare them later.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2747
    • View Profile
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)