If this is your first visit to our forums, welcome!
If you've been a VDF developer for a while you've undoubtedly come across [I]Pointer[/I], but what about the [I]Address[/I] type? Isn't that just redundant? [I]Pointer[/I] has been around seemingly forever, but you may or may not know that [I]Pointer[/I] is not a real data type in its own right. If you type [I]Pointer[/I] in the Visual DataFlex Studio editor and hover your mouse cursor over the word, you'll see a tooltip that says "Alias type Pointer Integer". So even though ...
A while ago I received a question about why the following code is not working as expected: [code] String[] listData ... Move (SendMessage(hWnd, LB_ADDSTRING, 0, AddressOf(listData[iIndex]))) to iRetval [/code] It's a little tricky, but the code is expecting a pointer to a null terminated C-style string. And usually [I]AddressOf()[/I] will produce that with a local string variable. But in this case [I]AddressOf()[/I] actually returns a pointer ...
To wrap up this multi-part series about arrays and structs I'll highlight a few key areas and answer some questions that came up. [URL="http://support.dataaccess.com/forums/blog.php?b=26"]Part I[/URL] starts by showing the basic use of structs and arrays, how they can be used together and as parameter & return types. [URL="http://support.dataaccess.com/forums/blog.php?b=27"]Part II[/URL] discusses how sorting and searching works with native arrays. ...
In [URL="http://support.dataaccess.com/forums/blog.php?b=39"]Part V[/URL] we realized that there's a very common mistake one can make when working with array properties and trying to write code designed after the old Array class interface, which can cause performance issues. When making changes to array properties, and you're concerned about performance, the key thing is to coalesce/combine all changes into one transaction. Remember that a [I]Get[/I] property is always super-fast. There's ...
In [URL="http://support.dataaccess.com/forums/blog.php?b=36"]Part IV[/URL] we discovered that passing very large arrays around via parameters and return values is usually very fast thanks to the built-in copy-on-write optimization. We also discovered that if you modify the array, you incur a copy operation and lose the benefit of the copy-on-write optimization. It may come as no surprise then that the fewer copy operations you perform, the better performance you get. Up ...
In [URL="http://support.dataaccess.com/forums/blog.php?b=29"]Part III[/URL] we discovered that arrays work great together with struct types, and that native arrays are clearly much easier to use than the old Array class, but what about performance? A simple test shows that the basic use of native arrays (reading/writing elements) compare very favorably against the old-school Array class. In fact, native arrays are a little faster. Your mileage may vary depending on the data type as well ...
Amidst all the Arrays & Structs in-depth multi-part series by Sonny Falk, why not take a look at an example of using an array? The code shown here uses a single-dimensional array as the base for a stack class. A stack is, by definition, a "last in, first out" (LIFO) abstract structure where elements can be added or taken off from only one end, called the "top". A stack can have any abstract data type as an element, but is characterized by two fundamental operations: push and pop. ...
In [URL="http://support.dataaccess.com/forums/blog.php?b=27"]Part II[/URL] of this multi-part series we discussed sorting and searching arrays, and we also mentioned that multi-dimensional arrays aren't really suited for sorting and searching, we'll dig into that a little deeper here and see how a struct type is often a better solution. [B]Multi-dimensional Arrays[/B] Despite what the documentation may seem to suggest, you really cannot sort multi-dimensional arrays. ...
In [URL="http://support.dataaccess.com/forums/blog.php?b=26"]Part I[/URL] we were just getting warmed up and started looking at the basics of arrays and struct types. Now things are about to get more complicated as we dig in deeper. [B]Sorting Arrays[/B] If you have [I]Integer[] myArray[/I] for example, then sorting is very simple and straightforward. You simply do [I]Move (SortArray(myArray)) to myArray[/I], and you're done. The runtime takes care of all the magic ...
Native arrays have been around in Visual DataFlex for years now, it's obvious that native array types are preferred by far over the old Array class, but just what are the differences? For one, with native array types you can create local array variables without resorting to creating an object. That also means you can use array types as parameter types and return types, and the data is carried across method calls far easier than array objects. You also never have to worry about destroying an object, ...
Updated 3-Sep-2009 at 06:48 PM by Sonny Falk