Jump to content
Excelsior Forums
cmorpad

incompatible types

Recommended Posts

Hello,

I need help with this issue,

What's this error message caused for? I've tried several times to compile a simple program but have no idea of how to solve it.

* [readnum.mod 12.07 E029]

* incompatible types:

    "INT32"

    "PROCEDURE [Modula] (IOChan.ChanId,VAR INT32)"

  Num $:= ReadInt;

Thank you

Share this post


Link to post
Share on other sites

Here you are, these are the declarations I included.

      1 MODULE readnum;

      2

      3 FROM InOut IMPORT WriteString,WriteLn,WriteInt;

      4 FROM WholeIO IMPORT ReadInt;

      5 IMPORT SYSTEM;

      6

      7 VAR

      8        Num    : INTEGER;

Thank you

Share this post


Link to post
Share on other sites

  Num $:= ReadInt;

If you look at the Help file you will see that ReadInt is defined as a procedure which returns a value via a VAR parameter not as a function result. There are two possible uses:

  PROCEDURE ReadInt (cid: IOChan.ChanId; VAR int: INTEGER);

  PROCEDURE ReadInt (VAR int: INTEGER);

Thus you should write something like:

ReadInt(Num);

Share this post


Link to post
Share on other sites

Further to Chris' reply, you should always examine the definition of the function in the "DEF" file.  It tells you how to call it and what it returns.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×