#98 StrCat gets struck while concatenating uninitialized string

closed-fixed
John Hansen
NBC (24)
5
2011-07-27
2011-07-27
Olaf Holowenko
No

Hello,

if you try to StrCat an uninitialized string-variable with another string, the program gets stuck and starts tickin' (sounds like the firmware-update - what does this mean?). You can't reload the program, only removing the battery can restart the brick. Not error-code is returned.

Example (not working):
task main()
{
string s, ret;
ret = StrCat(s,"xyz"); // Program stucks here
TextOut(0, LCD_LINE1, ret);
Wait(1000);
}

If you replace
string s
by
string s=""
it works fine!

Example (working):
task main()
{
string s="", ret;
ret = StrCat(s,"xyz"); // Program stucks here
TextOut(0, LCD_LINE1, ret);
Wait(1000);
}

I'm using NBC-1.2.1r4-Compiler on Ubuntu-Linux.

Olaf

Discussion

  • Olaf Holowenko
    Olaf Holowenko
    2011-07-27

    ... Second "// Program stucks here"-Comment is a copy-n-paste-error and obsolete!

     
  • John Hansen
    John Hansen
    2011-07-27

    This has already been fixed in SVN. I will be releasing 1.2.1 r5 soon which will include this fix.

     
  • John Hansen
    John Hansen
    2011-07-27

    • status: open --> closed-fixed