1. Jesus and his HEX Number Problem {Rob??}

after reading jesus' last post about hexadecimal constants,
i thought he might be using %f in printf and i also
wondered what would happen if instead of using 'constant'
that he defined his constants as 'integers' and assigned
them values and so i whipped up the following:
-------------------------------
constant testnum = #FFFFFFFF
integer testnum2
testnum2 = #FFFFFFFF
printf(1, "%d\n",testnum)
printf(1, "%d\n",testnum2)
-------------------------------

here is the output:
-------------------------------
C:\blah>ex test
test.ex:3
type_check failure, testnum2 is 4.29497e+009
--> see ex.err
C:\blah>type ex.err
test.ex:3
type_check failure, testnum2 is 4.29497e+009
Global & Local Variables
 test.ex:
    testnum2 = 4.29497e+009
-------------------------------

ummmmm hello? ummmm testnum2 is *declared*
to be *integer*.... are Jesus and I both
screwed up? or... well i don't wanna think
about the or...
anyone?

<Stumped>Hawke'</Stumped>

new topic     » topic index » view message » categorize

2. Re: Jesus and his HEX Number Problem {Rob??}

Hawke said:
>i thought he might be using %f in printf
Not, just ? at the degugger window

>and i also wondered what would happen if instead of using 'constant'
>that he defined his constants as 'integers' and assigned
>them values
That should be the next step, but you answered so fast that your test saved
me of trying it.

>are Jesus and I both screwed up?
>or... well i don't wanna think about the or...
Me neither. For the sake of continuity, I've just put

constant INADDR_NONE         =    -1 -- #FFFFFFFF

and everything works fine...
That's what we call in Spanish "una chapuza". I don't know the word in
english, but is what I use to do when a water pipe breaks on saturday, I
have no tools, and nobody wants to come to fix it until monday... (just wrap
something around the pipe and firmly place on site with plastic strips...)

Why not to have qualified constants like "integer constant INADDR_NONE =
#FFFFFFFF"????
(Just another suggestion for the box).

Jesus-winsoking-properly

new topic     » goto parent     » topic index » view message » categorize

3. Jesus and his HEX Number Problem {Rob??}

All right.  I think I isolated one problem.  The thing must be declared a=
s
an atom.

Library.doc says that %d prints "an atom".

But, new problem.  Why doesn't this work?

atom test
test =3D 49
printf(1,%d,test)

--Alan

-------------------------------------------------
Visit my web page at:
http://ourworld.compuserve.com/homepages/atu5713/

 =

new topic     » goto parent     » topic index » view message » categorize

4. Re: Jesus and his HEX Number Problem {Rob??}

Alan Tu wrote:
>
> All right.  I think I isolated one problem.  The thing must be declared as
> an atom.
>
> Library.doc says that %d prints "an atom".
>
> But, new problem.  Why doesn't this work?
>
> atom test
> test = 49
> printf(1,%d,test)
>
printf(1,"%d",test) -- works better.

Regards,
Irv
> Visit my web page at:
> http://ourworld.compuserve.com/homepages/atu5713/
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: Jesus and his HEX Number Problem {Rob??}

On Fri, 3 Jul 1998 04:18:14 -0700, Hawke <mdeland at NWINFO.NET> wrote:

>-------------------------------
>constant testnum = #FFFFFFFF
>integer testnum2
>testnum2 = #FFFFFFFF
>printf(1, "%d\n",testnum)
>printf(1, "%d\n",testnum2)
>-------------------------------
>
><Stumped>Hawke'</Stumped>

According to Refman.doc, and I quote:
"type integer must be atoms with integer values
from -1073741824 to +1073741823 inclusive."

Thus, the largest value testnum2 can be is:
testnum2 = #3FFFFFFF

Hope this clarification helps. Obviously, this limitation is
related to the attempt to use #FFFFFFFF as equivalent to -1.


Terry Constant
constant at flash.net

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu