SPONSORS:






User Tag List

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Jul 2001
    Location
    Westford, MA, USA
    Posts
    160
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing by reference

    There is no C/C++-like capability to pass pointers, but you can use the Pascal-like in, out, and inout keywords. For more information, check out the SilkTest documentation on calling DLLs -- that's where you're likely to find the most doc on this, I think. Here's a simple example:

    Here's the output:
    [ ] Beginning value of i in Func1 is: 1.
    [ ] Beginning value of j in Func1 is: 1.
    [ ] Ending value of i in Func1 is: 1.
    [ ] Ending value of j in Func1 is: 2.

    --AG


    ------------------

  2. #2
    Member
    Join Date
    Aug 2001
    Location
    Burlington MA USA
    Posts
    35
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing by reference

    if I am writing a function, can i pass a variable's reference (address) to it rather than value?
    For example if I am writing a function in C++, and I want to pass a variable's referrence, I can define the function as

    void myFunction (int &i)
    {}

    is there any way I can do this in 4Test?

    Thanks,
    Mandar.

    ------------------

  3. #3
    Super Member
    Join Date
    Jul 2001
    Location
    Earth
    Posts
    1,882
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Passing by reference

    you can also use the reference operator:

    INTEGER MyIntegerVar = 0

    void UpdateValue (STRING sVariableToUpdate, ANYTYPE aNewValue)
    @(sVariableToUpdate) = aNewValue

    main ()
    Print (MyIntegerVar) // prints 0
    UpdateValue ("MyIntegerVar", 4)
    Print (MyIntegerVar) // prints 4

    in this case you aren't passing in the actual variable into the function but rather a reference to the variable's name and manipulating it that way via the reference operator (@)

    ------------------
    James Soderborg
    http://www.ameliortech.com
    jamesso@ameliortech.com

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:32 PM.

Copyright BetaSoft Inc.