Browsing this Thread:
1 Anonymous Users
|
Re: MOD function result must be INT!
|
||||
|---|---|---|---|---|
|
Home away from home
![]()
|
@mrdarek
On modern processors INT is usually no faster than the default type (VALUE, which is usually the same size as LONG). The main reason for using INT is to save memory! However, it would still be useful to show how to do this, since you may run into other situations where you will want to do this for a good reason. If you were ONLY using Mod()'s first return value, then it would be easy: Quote: DEF z1:INT This is called "casting". And this would also work: Quote: DEF z1:INT, z2 However, since you are using two return values (both of which need casting to INT), you will have to work-around this using an extra variable: Quote: DEF z1:INT, z2:INT, z2temp In general I find very little use for BYTE, INT & LONG, particularly for local variables (DEF), simply because they cause the need for a lot of casting, without much benefit. Therefore I feel it is best to avoid using them, except inside OBJECTs & CLASSes. On the other hand, I often use BOOL & CHAR, because they help catch errors.
Posted on: 2011/3/14 20:11
|
|||
|
||||
|
MOD function result must be INT!
|
||||
|---|---|---|---|---|
|
Just can't stay away
![]() |
My Code:
DEF z1:INT DEF z2:INT z1,z2:=MOD(width,height) ---------- and got compilation error: Hint: assigned variable has type INT, procedure's return value has type VALUE. Speed is important in my program so I must have INT but how?
Posted on: 2011/3/13 16:24
|
|||
|
||||
You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.






