FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

String concatenation

 
Post new topic   Reply to topic     Forum Index -> Ares
View previous topic :: View next topic  
Author Message
lightoze



Joined: 12 Feb 2006
Posts: 35

PostPosted: Mon Apr 03, 2006 11:05 am    Post subject: String concatenation Reply with quote

I have string1~string2=string1 error and suppose this is about memory managment and GC.
I call sys.linux.c.linux.readdir() function and it returns (dirent*). Then I use dirent.d_name string from this structure, and error cause may be in allocation issues (but using dirent.d_name.dup does not help).
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Mon Apr 03, 2006 1:37 pm    Post subject: Reply with quote

I don't understand. This code:
Code:
import std.c.stdio;


void main()
{
    char[] a = "abc".dup;
    char[] b = "def".dup;
   
    a = a ~ b;
   
    printf( "?.*s\n?.*s\n", a, b );
}
prints
Quote:
abcdef
def

as expected, while
Code:
import std.c.stdio;


void main()
{
    char[] a = "abc".dup;
    char[] b = "def".dup;
   
    a ~ b = a;
   
    printf( "?.*s\n?.*s\n", a, b );
}
doesn't compile. Can you give me some sample code that isn't behaving how you expect?
Back to top
View user's profile Send private message
lightoze



Joined: 12 Feb 2006
Posts: 35

PostPosted: Mon Apr 03, 2006 3:54 pm    Post subject: Reply with quote

I meant than "str1 ~ str2" gives str2 as result. I have tried to separate code, but it works when I do so. I'll try to debug concatenation in Ares runtime later.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Ares All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group