View RSS Feed

Development Team Blog

  1. Address and Pointer, what's up with that?

    by , 1-Apr-2010 at 08:00 AM (Development Team Blog)
    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 ...
  2. AddressOf() does/did not work as expected with String[]

    by , 15-Mar-2010 at 09:00 AM (Development Team Blog)
    A while ago I received a question about why the following code is not working as expected:

    String[] listData
    Move (SendMessage(hWnd, LB_ADDSTRING, 0, AddressOf(listData[iIndex]))) to iRetval

    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 ...
  3. Arrays & Structs in-depth - Conclusion

    by , 6-Oct-2009 at 08:00 AM (Development Team Blog)
    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=""]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=""]Part II[/URL] discusses how sorting and searching works with native arrays. ...
  4. Arrays & Structs in-depth Part VI

    by , 25-Sep-2009 at 08:00 AM (Development Team Blog)
    In [URL=""]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 ...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	without-access-methods.jpg 
Views:	1945 
Size:	40.3 KB 
ID:	3773   Click image for larger version. 

Name:	array-property-comparison.jpg 
Views:	1978 
Size:	46.0 KB 
ID:	3774  
    Attached Thumbnails Attached Files
  5. Arrays & Structs in-depth Part V

    by , 23-Sep-2009 at 08:00 AM (Development Team Blog)
    In [URL=""]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 ...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	with-access-methods.jpg 
Views:	2044 
Size:	42.4 KB 
ID:	3772  
    Attached Thumbnails Attached Files
  6. Arrays & Structs in-depth Part IV

    by , 18-Sep-2009 at 08:00 AM (Development Team Blog)
    In [URL=""]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 ...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	perf-result1.jpg 
Views:	2788 
Size:	56.0 KB 
ID:	3767   Click image for larger version. 

Name:	perf-result2.jpg 
Views:	1189 
Size:	27.5 KB 
ID:	3768   Click image for larger version. 

Name:	perf-result3.jpg 
Views:	1176 
Size:	24.1 KB 
ID:	3769  
    Attached Thumbnails Attached Files
  7. Need a Stack Class?

    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. ...
  8. Arrays & Structs in-depth Part III

    by , 10-Sep-2009 at 08:00 AM (Development Team Blog)
    In [URL=""]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. ...
  9. Arrays & Structs in-depth Part II

    by , 8-Sep-2009 at 08:00 AM (Development Team Blog)
    In [URL=""]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 ...
  10. Arrays & Structs in-depth Part I

    by , 3-Sep-2009 at 08:00 AM (Development Team Blog)
    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