Ages ago, Ben Combee <[EMAIL PROTECTED]> wrote:
> any chance of a future SDK having FrmGetObjectPtr
> return a "FormObjectType" rather than the current "void *".  Effectively its
> just a prototype change, but it would make the intent clearer, and avoid
> ugly C++ casting, since you could use the union member to get at the
> appropriate pointer type.

But it would introduce ugly C casting, since you could no longer use
the implicit conversion in

        /* Valid in C only!!  */
        FieldType *field = FrmGetObjectPtr (form, id_EditField);

Of course C programs could use the union member too, but the point is
that existing C source code which assumed that the implicit conversion
would happen would get broken.

Sorry.  No can do.

In my C++ projects, I have a header file with a bunch of functions like

    inline FieldType*
    GetFieldPtr (FormType* f, UInt16 id) {
      return static_cast<FieldType*>(FrmGetObjectPtr (f,
                                              FrmGetObjectIndex (f,id)));
      }

This concentrates all the ugly casting in one place.  I daresay Keith
could come up with something even better involving templates.  :-)

    John  "still looking at FrmSetTitle"

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to