v4.80 bèta: string concat problem using '+' (OK, my fault)

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

v4.80 bèta: string concat problem using '+' (OK, my fault)

#1 Post by Dany » 15 Jun 2011 12:12

Please ignore this post. It was entirely my fault. I oversaw that " StrCat(S1, S2);" made S1 too long to be concatinated with S2 into S3. :oops: :oops: :oops: :oops: Soooo sorry!

Hi, in v4.80 bèta I have seen in the software debugger a string concat problem:
Testcode:

Code: Select all

Var S1, S2, S3: string[10];
...
  S1 := 'xxxxxxx';
  S2 := 'yyy';
  S3 := 'zzzz';
  
  StrCat(S1, S2);                 // Ok , result = 'xxxxxxxyyy' + ending 0
  
  S3 := '';
  S3 := S1 + S2;                  // wrong, result = 'xxxxxxxyyyy' (no ending zero, 4 times 'y')
                                  //      side-effect: S2 becomes 'yy' (1 character shorter)
                                  
  S3 := '';
  S3 := S1 + 'yy';                // wrong, result = 'xxxxxxxyyyy' (no ending zero, 4 times 'y')
                                  //      side-effect: S2 becomes 'y' (again 1 character shorter)
Also seen in mP dsPIC v4.80 bèta.

I can not really believe that above is true. Can someone confirm (or deny) this?

Thanks in advance.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: v4.80 bèta: string concat problem using '+' (OK, my faul

#2 Post by Dany » 15 Jun 2011 18:19

Please ignore this post. It was entirely my fault. I oversaw that " StrCat(S1, S2);" made S1 too long to be concatinated with S2 into S3. :oops: :oops: :oops: :oops: Soooo sorry!

I am so happy that it is not something in the compiler, only one stupid me... :? :?
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: v4.80 bèta: string concat problem using '+' (OK, my faul

#3 Post by janni » 16 Jun 2011 00:02

Soon, I hope, all discovered errors will be solely our own :) .

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”