Adam Wozniak <[EMAIL PROTECTED]> wrote:
>> MemSet() works exactly as documented.
> 
> IMHO this is one of the most broken parts of the API.

Agreed.

> I'd really like to see this function renamed in some future release of
> PalmOS.  I think renaming it would prevent some confusion.  MemFlood() ?

I trust you don't really mean renaming the existing function.  That would
lead to silent (i.e., impossible to warn about at compile time) changes
in people's programs.  The only way to really rename it would be if
you were willing to activate the new MemSet() behaviour by invoking the
compiler with something like

        -DFIXED_UP_MEMSET_PLEASE_AND_I_PROMISE_NOT_TO_BLAME_PALM_IF_\
        THERE_ARE_ANY_OLD_STYLE_REVERSED_MEMSETS_LURKING_ANYWHERE_IN_\
        MY_CODE_THAT_JUST_SILENTLY_CHANGED_THEIR_MEANINGS

The only sane thing to do is to add a new function with the standard
memset() signature.  You can do this yourself today:

        Err MemSet_palmos(void *dstP, Int32 numBytes, UInt8 value)
            SYS_TRAP(sysTrapMemSet);  /* Copied from MemoryMgr.h.  */
        #define MemFlood (p, val, n)  MemSet_palmos (p, n, val)
        void dont_use_MemSet();  /* Not defined anywhere.  */
        #define MemSet  dont_use_MemSet

Now you have a MemFlood() function that works like the standard memset(),
and a MemSet() function that gives link errors.  This is good, but I'm
not quite sure that the names are acting to *reduce* confusion here.

(And it's all macros, so your error messages will be incomprehensible :-()

I personally think the best way out of this naming conundrum is to call
the new function memset(), and in general to use standard C library
functions instead of their barely compliant AlmostStandardCLibrary
Palm OS equivalents.  That way we can all leverage our std C knowledge
instead of learning the foibles of some new functions!  That's why
prc-tools comes with (parts of) a libc implementation (except that Linus
got the signature of memset() wrong, but not as badly as Ron did).

    John

-- 
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