Shop OBEX P1 Docs P2 Docs Learn Events
Strange bug in LOOKUP !!!! — Parallax Forums

Strange bug in LOOKUP !!!!

ArchiverArchiver Posts: 46,084
edited 2003-04-21 22:38 in General Discussion
Hi
Pls see the following code : There seems to be a
strange bug in the LOOKUP command. Or theres something
strange i am doing. Pls advise

inp var nib
inp = INC rev 4 'read inp from Ios
debug ? inp 'FIRST DEBUG
LOOKUP inp , [noparse][[/noparse]2500,3000,3500,4300,1800,2000,2300,
0,3800,3600,3300,4300,3500,3000,2500], w1
debug ? inp 'SECOND DEBUG

The problem is that the first and second debug give
different values?. Is the stamp corrupting the 'inp'
nibble after using it in the Lookup command.In the
manual it doesn't say so . But it seems to be
happening. Anyone with a solution, diagnosis, similar
experiences .Pls comment

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-04-21 22:38
    Not a bug ... sloppy programming.

    You've actually created the problem by mixing your own variable declaration
    (inp) with a predefined variable name (W0). This is a big NO-NO. In fact, I
    very strongly suggest that you DON'T use internal variable names; don't be
    lazy ... use named variables and let the compiler assign their location.

    What's happening is that inp is the same as W0.Nib0 so when you change W0 you
    end up changing inp. You can fix this problem programming by declaring a
    named word variable for the output of your LOOKUP function.

    -- Jon Williams
    -- Applications Engineer, Parallax


    In a message dated 4/21/2003 3:49:21 PM Central Standard Time,
    suri_list@y... writes:

    > Hi
    > Pls see the following code : There seems to be a
    > strange bug in the LOOKUP command. Or theres something
    > strange i am doing. Pls advise
    >
    > inp var nib
    > inp = INC rev 4 'read inp from Ios
    > debug ? inp 'FIRST DEBUG
    > LOOKUP inp , [noparse][[/noparse]2500,3000,3500,4300,1800,2000,2300,
    > 0,3800,3600,3300,4300,3500,3000,2500], w1
    > debug ? inp 'SECOND DEBUG
    >
    > The problem is that the first and second debug give
    > different values?. Is the stamp corrupting the 'inp'
    > nibble after using it in the Lookup command.In the
    > manual it doesn't say so . But it seems to be
    > happening. Anyone with a solution, diagnosis, similar
    > experiences .Pls comment



    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.