Computer Science Canada flexible arrays in type record?!? (and also subprogram parameters) |
Author: | chopperdudes [ Sat Dec 20, 2008 9:44 pm ] |
Post subject: | flexible arrays in type record?!? (and also subprogram parameters) |
unless i'm doing something wrong, flexible arrays can't be used as a typeSpec in a type record construct, which is rly inconvenient... is there any way around this (like how multi-D arrays can be resized)? or is it just stuck as it is and i'll have to find other ways out? also flexible arrays can't be passed as var parameters to procedures, any ways around this too? thx in advance |
Author: | Clayton [ Sat Dec 20, 2008 10:27 pm ] | ||
Post subject: | RE:flexible arrays in type record?!? (and also subprogram parameters) | ||
|
Author: | chopperdudes [ Sat Dec 20, 2008 10:33 pm ] |
Post subject: | RE:flexible arrays in type record?!? (and also subprogram parameters) |
clayton i think you misunderstood me. of course that will work, but it wont work if i want to new the var array bar inside the procedure. instead if you want to new a flexible array inside a procedure you can't pass parameter and you can only use a global flexible array. and does any1 know any possible way around the type record part? that's my biggest inconvenience right now. |
Author: | Clayton [ Sat Dec 20, 2008 10:38 pm ] |
Post subject: | RE:flexible arrays in type record?!? (and also subprogram parameters) |
Let me ask you this then: Why are you passing a dynamic array to a procedure that will mutilate your precious variable? Why not have a function to return an array that you can use instead? |
Author: | chopperdudes [ Sat Dec 20, 2008 10:45 pm ] | ||
Post subject: | Re: flexible arrays in type record?!? (and also subprogram parameters) | ||
well for example (and i'm making this on the top of my head):
|
Author: | Clayton [ Sun Dec 21, 2008 11:29 am ] | ||||
Post subject: | RE:flexible arrays in type record?!? (and also subprogram parameters) | ||||
Implemented with:
Note: This is untested, but shows the general idea. |