× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



> From: Simon Coulter
>
> P bestProcDesign      B
> D                     PI       5I 0
> D ptrArray            S         *     STATIC DIM(100)
> D i                   S        5I 0   STATIC INZ(0)
> C                     EVAL    i = i + 1
> C                     ALLOC   100     ptr(i)
> C                     RETURN  i
> P                     E
>
> bestProcDesign is the best of these designs because it exposes no
> information about the internal design.  It returns only a handle (in the
> true sense) which can be used by subsequent functions.  This approach
> generally requires a series of support methods to accept the handle and do
> something with it.  For instance:
>       aHandle getXxxHandle()
>       rlsXxxHandle( aHandle )
>       doStuff( aHandle, p1, p2, ... )

Precisely correct.  This is in fact exactly what we did at SSA when we
created the Assistant products, which were written entirely in C for OS/2.
The only difference is that we used a void pointer for our handle.  While
the calling program could not (easily) use the pointer for anything, during
debugging it made our lives a little easier than having to use the handle as
an index into an array of pointers (especially if the array's address was
not immediately available).

We actually used a DWORD at the beginning of every structure which was
initialized to a three-character constant followed by a X'00', so that when
you viewed the "contents" of a properly initialized handle, you would see
the appropriate three-character string.  This allowed us to quickly verify
that a handle held the right kind of object.  A mismatch was a very
primitive form of manual class cast exception.

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.