Announcement

Collapse
No announcement yet.

Array (Insert,Delete)

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

  • Lance Edmonds
    replied
    ARRAY DELETE is 100% fine - there have been ZERO problem reports!

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

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Hey Guys,

    Thanks for the reply's but this is what I'm really after. Is the following "legal" are there any know bug's in this method?


    Code:
    type RECORD_STRUCT
        lPointer as long
        wUpdated as word
        wDeleted as word
    end type
     
    
    global Record() as RECORD_STRUCT
     
    
    function DeleteRecord(byval lRow as long) as long
        local lCount as long
     
    
        lCount = ubound(Record)
        decr lCount
     
    
        array delete Record(lRow)  rem Will this work?
        redim preserve Record(lCount)
        function = min(lRow,lCount)
    end function
     
    
    function pbmain as long
        local lRow as long
     
    
        redim Record(100)
     
    
        lRow = DeleteRecord(20)
    end function
    I know there is a problem with ARRAY INSERT when used with UDT arrays so does the same apply for ARRAY DELETE ?

    ------------------
    Cheers!



    [This message has been edited by mark smit (edited April 25, 2001).]

    Leave a comment:


  • Lance Edmonds
    replied
    Eddy, that is not quite the same discussion...

    In a nutshell, you can use the ARRAY statement on arrays in a UDT as long as you use DIM..AT to create a normal array at the same location of memory as the UDT member array. The 1st reply points to an example of this.


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

    Leave a comment:


  • Eddy Van Esch
    replied
    originally posted by john petty:
    simply put you can't use udt's
    yes you can john.
    mark, check out this post: http://www.powerbasic.com/support/pb...ad.php?t=18125
    kind regards
    eddy



    ------------------
    [email protected]

    Leave a comment:


  • John Petty
    replied
    simply put you can't use udt's
    see http://www.powerbasic.com/support/pb...ad.php?t=18113

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

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Array (Insert,Delete)

    Array (Insert,Delete)

    Hello Everyone,

    Can somebody explain to me some of the pitfalls in using ARRAY INSERT and DELETE with UDTs. I also would like to know why ARRAY INSERT and DELETE do not resize the array.

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