"Thomas Maeder" <[EMAIL PROTECTED]> wrote in message
news:67777@palm-dev-forum...
>
> Compiler & Debugger: CodeWarrior 7.1 for Palm (IDE version 4.1.0.3,
Build
> 0654)
> Emulator: Palm OS Emulator 3.2
>
> The following snippet produces the error message
>
> [Your app] just executed an illegal or unknown machine instruction.
The
> opcode was 0xA22E
>
>         unsigned int const len(50);
>         char src[len];
>         using std::fill;
>         fill(src,src+len-1,' ');
>         src[len-1] = 0;
>         char dest[len];
>         using std::copy;
>         copy(src,src+len,dest);
>
> The problem occurs if len exceeds 32. On a real palm device, the same
code
> produces a Fatal Exception.
>
> Is this problem known?

Not yet.  Lets look at it.

You're using the STL algorithm fill.  This copies the third parameter to
each item in the vector [first, last).  In this case, it should modify
src through src[48] -- note, you're not setting src[49], since the fill
does not include the final element mentioned.

You then explicitly set src[49] to 0.  Fine.

You now setup a character array and use the STL algorithm copy to copy
one character array to another.  When this completes, it should produce
a C string of 49 spaces and a NUL terminator.

This all seems fine.  In a debug build of a C++ program using CW Palm 8,
this code ran perfectly.  When I increased the optimization level, it
also worked fine.  I then moved the code back to CW Palm 7.1.  It worked
fine there, both in debug and release.

Is there something you're leaving out?  Is your MSL access path set to
"{Compiler}/Palm OS Support/CodeWarrior Libraries/(MSL)"?  (Note: on CW
Palm 8, you just set it to "{Compiler}/(MSL for Palm OS)")

I am using POSE 3.3 and recent ROM images, but everything else should be
as your specified.  I just added your code to the top of my AppStart
function.



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