Missing return value should be a warning, not a fatal error

Post your requests and ideas on the future development of mikroPascal.
Post Reply
Author
Message
Ric
Posts: 44
Joined: 01 Mar 2007 10:35
Location: Italy

Missing return value should be a warning, not a fatal error

#1 Post by Ric » 05 Mar 2007 11:30

I have to add a fake assignment to Result to every function written completely in assembler.

Code: Select all

function MyFunc: Byte;
begin

  asm
    // Assembler code
    RETURN
  end;

  Result := 0;

end;
A missing return value should IMHO be a warning, as it is for instance in Borland compilers, not an error.

Ric
Posts: 44
Joined: 01 Mar 2007 10:35
Location: Italy

#2 Post by Ric » 08 Mar 2007 14:42

As Janni pointed out here http://www.mikroe.com/forum/viewtopic.php?p=47602#47602, the way to go is assign to Result in pascal even when the function is written completely in Assembler, so that, should the way the compiler handles return values change over mikroPascal versions, the code will only have to be recompiled.

That's fine. It wastes (not so much) RAM and code, but it's good enough to me.

I'm writing this so that if someone happens to read this thread while searching the forum about the same topic, he/she will not think that no one replied at all, which is often descouraging. Granted, no one at mikroE replied directly, but I got help from other users in a thread about a related topic, and they shared with me what they have learnt both by experimenting and on the forum. My best thanks to Warren (a.k.a. xor) and Janni.

Post Reply

Return to “mikroPascal Wish List”