|
|
|
Re: An Easy Data Processing Project For Roger (or anyone) � April 22, 2011
|
Posted by Skywise on April 23, 2011 at 18:21:52:
Same in XB regarding arrays. I REDIM all the time, especially when reading in a data file of unknown size. Yes, pointers can cause problems, but they are also extremely useful. For example, something called "pass by reference", which is used to pass large amounts of data to (or from) a function for processing. Instead of passing all the contents of the array to the function, you pass the pointer instead. In other words, you don't give someone the book, you tell them where they can find it. Another trick is something like this: X = Function() This would return a value from the function, but you can only return one value from a function. What if you need to return 3? X, Y, Z. Since you can't do, X, Y, Z = Function() you instead do: Function(@X, @Y, @Z) @ is the symbol which tells the compiler not to pass the actual value of the variable, but it's pointer instead. The function does it's trickery and stores the results at those locations. Slick, eh? Took me a little while to understand that one. As for the potential problems, I've found XB to be very resilient to mistakes in that regard as well as others. For example, it's not possible to have a buffer overflow in XB like you can in C, which is one way in which hackers break into computers. hmmmm...maybe we should rename this place the "Earthwaves Programming Forum"? Brian
|
|
|