STRING Join BUG

Windows specific questions.
Post Reply
fbfans
Posts: 17
Joined: Nov 27, 2023 0:29

STRING Join BUG

Post by fbfans »

'----------------------------------------------------------------------
Scope 'BUG UTF8 And ANSSI TWO MODE
Dim c As String
For n As Integer = 1 To 750000
c = c + WStr("aa") ' c = c + Str("aa") is OK
Next
Print Len(c)
End Scope
'----------------------------------------------------------------------
Scope 'BUG UTF8 Mode
Dim c As String
For n As Integer = 1 To 750000
c = c + "aa" 'c = c + Str("aa") is OK
Next
Print Len(c)
End Scope
'----------------------------------------------------------------------
Scope 'BUG UTF8 and ANSSI TWO Mode
Dim c As String
For n As Integer = 1 To 750000
c = c + "aa"+"bb" 'c=c+ (Str("aa")+Str("bb")) or c &= Str("aa")+Str("bb") IS OK
Next
Print Len(c)
End Scope
'----------------------------------------------------------------------
Scope 'BUG UTF8 and ANSSI TWO Mode
Dim c As String
For n As Integer = 1 To 750000
c = c + Str("aa")+Str("bb") 'c=c+ (Str("aa")+Str("bb")) or c &= Str("aa")+Str("bb") IS OK
Next
Print Len(c)
End Scope

'----------------------------------------------------------------------
Scope
Dim c As String
For n As Integer = 1 To 750000
c = "o" & c
Next
Print Len(c)
End Scope
Last edited by fbfans on Jan 31, 2024 23:45, edited 9 times in total.
fxm
Moderator
Posts: 12135
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: STRING Join BUG

Post by fxm »

fbfans
Posts: 17
Joined: Nov 27, 2023 0:29

Re: STRING Join BUG

Post by fbfans »

fxm wrote: Jan 29, 2024 18:59 linked with Memory Leak UTF-8 mode Select Case Case ?
No memory leak occurred, but the program will not return for a long time, like a dead loop program
fbfans
Posts: 17
Joined: Nov 27, 2023 0:29

Re: STRING Join BUG

Post by fbfans »

Scope
Dim c As String
For n As Integer = 1 To 750000
c = "o" & c
Next
Print Len(c)
End Scope
SARG
Posts: 1768
Joined: May 27, 2005 7:15
Location: FRANCE

Re: STRING Join BUG

Post by SARG »

yes a bit long due to string concatenation in a temporary variable then assignment of this string in c string.
And it seems there is also a memory leak.
Post Reply