swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Errors from includes & casts


From: Paul E. Johnson
Subject: Re: Errors from includes & casts
Date: Mon, 13 Sep 1999 23:16:53 -0500

Darren Schreiber wrote:

> 
> >DS> SchellingWorld.m:64: warning: return type for `getRandomIntMin:Max:'
> >
> >What is the definition of this method? (I guess you have a good reason
> >for not using uniformIntRand, directly?)
> 
> No, I didn't have a good reason, so I have now directly linked to the
> uniformInteger object now.
> 
> But, I still am wondering why I get the
> 
>  SchellingWorld.m: In function `_i_SchellingWorld__findEmptyLocation_':
>  SchellingWorld.m:64: warning: cannot find method.
>  SchellingWorld.m:64: warning: return type for `getRandomIntMin:Max:'
>  defaults to id
Look at your syntax. Look at the swarmdocs section on random numbers. 
You will obtain the answer.

> >
> >You can probably make this go away by changing the type of this variable
> >to `id'; probably referencing a symbol that isn't defined yet.
> 
> This points to question I have.  It is my impression that lots of code I've
> looked at uses this "SchellingWorld * myWorld;" construction.  Should I be
> declaring this pointer myWorld as type id first?

No, you can either define it with
  id myWorld;

or with the pointer, not both. The id usage gives no compile time
checking to see that everything you do with the myWorld object is
"relevant".  If in the SchellingWorld, you have no method
"doThisAndThat" and your code has a command [myWorld doThisAndThat], you
will get a runtime crash because myWorld does not respond to that
message.  If you use the pointer definition, it gives the compiler
enough information, so it will warn you that myWorld does not have a
function doThisAndThat.


-- 
Paul E. Johnson                         email: address@hidden
Dept. of Political Science              http://lark.cc.ukans.edu/~pauljohn
University of Kansas                    Office: (785) 864-9086
Lawrence, Kansas 66045                  FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]