HELP! Passing Integers by Value
Author Message
HELP! Passing Integers by Value

Can anyone tell me what's wrong with this code.  I'm trying to pass two
integers to a long-integer function that will use ASM to calculate
combinations.  My current code begins:

'    Main Program
DECLARE FUNCTION COMB&(BAG%,TAKE%)
JOE&=COMB&(CINT(6%),CINT(4%))
PRINT JOE&
END

'Beginning of a function
FUNCTION COMB& (byval BAG%,byval TAKE%)

I keep getting "error 481: Parameter mis-match; may need ByCopy" on the
FUNCTION statement.  I definitely want to send the parameters by value
because later I'm going to use the same function and pass it things like
CINT(25 - A% + B%).  It sure looks to me like I'm doing everything
possible to send two integers.  Am I missing something?

Sat, 08 Feb 2003 03:00:00 GMT
HELP! Passing Integers by Value
An uninformed, untested guess: you need the BYVAL keyword in your
DECLARE statement.

Quote:
>Can anyone tell me what's wrong with this code.  I'm trying to pass two
>integers to a long-integer function that will use ASM to calculate
>combinations.  My current code begins:

>'    Main Program
>DECLARE FUNCTION COMB&(BAG%,TAKE%)
>JOE&=COMB&(CINT(6%),CINT(4%))
>PRINT JOE&
>END

>'Beginning of a function
>FUNCTION COMB& (byval BAG%,byval TAKE%)

>I keep getting "error 481: Parameter mis-match; may need ByCopy" on the
>FUNCTION statement.  I definitely want to send the parameters by value
>because later I'm going to use the same function and pass it things like
>CINT(25 - A% + B%).  It sure looks to me like I'm doing everything
>possible to send two integers.  Am I missing something?

Sat, 08 Feb 2003 03:00:00 GMT
HELP! Passing Integers by Value
Yup.

Thanks much.

Quote:

> An uninformed, untested guess: you need the BYVAL keyword in your
> DECLARE statement.

> >Can anyone tell me what's wrong with this code.  I'm trying to pass two
> >integers to a long-integer function that will use ASM to calculate
> >combinations.  My current code begins:

> >'    Main Program
> >DECLARE FUNCTION COMB&(BAG%,TAKE%)
> >JOE&=COMB&(CINT(6%),CINT(4%))
> >PRINT JOE&
> >END

> >'Beginning of a function
> >FUNCTION COMB& (byval BAG%,byval TAKE%)

> >I keep getting "error 481: Parameter mis-match; may need ByCopy" on the
> >FUNCTION statement.  I definitely want to send the parameters by value
> >because later I'm going to use the same function and pass it things like
> >CINT(25 - A% + B%).  It sure looks to me like I'm doing everything
> >possible to send two integers.  Am I missing something?

--
"Out here {*filter*}, in front of a man -- you feel like a criminal."
-- inmate at DC jail on being strip-searched (Wash Post, 3/21/00)

Sat, 08 Feb 2003 03:00:00 GMT
HELP! Passing Integers by Value

Quote:
> Can anyone tell me what's wrong with this code.  I'm trying to pass two
> integers to a long-integer function that will use ASM to calculate
> combinations.  My current code begins:

> '    Main Program
> DECLARE FUNCTION COMB&(BAG%,TAKE%)
> JOE&=COMB&(CINT(6%),CINT(4%))
> PRINT JOE&
> END

> 'Beginning of a function
> FUNCTION COMB& (byval BAG%,byval TAKE%)

Put the ByVal in the DECLARE statement as well.  Also, you don't need the
CINT function to convert 6% and 4% to integers.  They already ARE integers.

Tom L

Sun, 09 Feb 2003 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages