Announcement

Collapse
No announcement yet.

Reset UDT in an array?

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

  • Semen Matusovski
    replied
    Lance --
    I am about perfomance.
    Somebody tried to compare (depends of size)?

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

    Leave a comment:


  • Lance Edmonds
    replied
    There are quite a few ways available to the programmer to clear a UDT or other block of memory:

    LSET, ZeroMemory(), POKE$, use of pointers, DIM...AT, etc.

    However, the request was for a single native BASIC statement to do the job.

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

    Leave a comment:


  • Semen Matusovski
    replied
    What about API ZeroMemory ?

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

    Leave a comment:


  • Lance Edmonds
    replied
    RESET is likely to be made to work with scalar variables in a future version of the compiler, but not individual array subscripts.

    However, I'll suggest this idea to R&D. Thanks!



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

    Leave a comment:


  • mark smit
    Guest replied
    Thanks Lance!

    I figured that much out but i still think it would be nice to have this feature in PBDLL/PBCC.



    ------------------
    Cheers

    Leave a comment:


  • Lance Edmonds
    replied
    LSET UDT(0) = STRING$(LEN(UDT(0)), 0)

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

    Leave a comment:


  • mark smit
    Guest started a topic Reset UDT in an array?

    Reset UDT in an array?

    Hello All...

    I just tried the following line and found that it didn't work, Would anybody also like to see this added to the next release?

    Code:
    type USERDATA
      dataname as asciiz * 257
      datasize as long
    end type
    
    dim user(%MAXUSERS) as USERDATA
    
    reset user(0) <- This does not seem to work...?
    This would be a great feature to have because it would allow a programmer to clear a UDT array element with one line rather than having to clear all the members one at a time. According to the help file you can clear a UDT though!


    -------------
    Cheers
Working...
X