Announcement

Collapse
No announcement yet.

ByCopy and Global Var's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Turchin
    replied
    Thanks Lance,
    I knew you had answered this question before.
    The bug actually went away after I rebooted. I beat my head against the wall for 4 hours and then said the heck with it and rebooted...

    (Well I didnt' literally beat my head against the wall


    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Lance Edmonds
    replied
    Yup, BYCOPY seems quite reasonable, provided the target sub/function is expecting a BYREF dynamic string.

    For all intents and purposes (with this type of usage), there is little difference between BYVAL/BYCOPY unless the target sub/function is expecting the string BYVAL, in which case, BYCOPY will not be the best choice.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Scott Turchin
    started a topic ByCopy and Global Var's

    ByCopy and Global Var's

    I probably know the answer to this but lets see what others think.


    I have a global variable g_hdEncryptionKey lets say...
    It contaisn a HEX EQUIVELANT of a binary key used for en cryption, so lets say that key looked like this:


    g_hdEncryptionKey = "A1B2C3D4E5F6A1B2C3D4E5F6"


    Now, I want to keep this global variable just the way it is and then allow each function to call yet another function which will then modify the key for it's purpose.

    I don't want it modifying the Global key however because other functions need it just like it is.


    What's the "BEST" way to do this?
    It's only 16 bytes long basically, would this be ByVal or ByCopy? I want to pass a COPY of the key basically...

    Think I answered my own question but lets see...

    Scott

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
Working...
X