Re: cu coredumps

看板DFBSD_bugs作者時間21年前 (2004/10/28 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串8/19 (看更多)
Timour Ezeev wrote: > You got the first case AFAIK, but for the second case you are loosing cp > when you assign it to tmp_cp. The possible solutions are: Yeah, I didn't quite understand the second case. I was thinking that because cp is just a local variable which holds the /dev/cuaa1 part (for example) out of name (or atleast I think that's what it's doing), then it wouldn't matter too much if I lost what was previously in cp? > > 1. Create new temp holder (in else) for cp and free() it after > assignment > or > 2. If you dont want to create a new pointer, swap pointers in plase, > like this > > (int)tmp_cp ^= (int)cp; (int)cp ^= (int)tmp_cp; (int)tmp_cp ^= (int)cp; > free(tmp_cp); Pointers and dynamic memory allocation stuff still confuses me a bit, which isn't much of a suprise considering I have only had 4 weeks of C programming stuff at University, then they moved onto Matlab :( What does the ^= mean in the above? > > or something similar :) > > Regards, > Thanks for your help! -- Internet Explorer? Try FireFox at http://www.mozilla.org/products/firefox/ Outlook Express? Try ThunderBird at http://www.mozilla.org/products/thunderbird/
文章代碼(AID): #11V-9_00 (DFBSD_bugs)
文章代碼(AID): #11V-9_00 (DFBSD_bugs)