[02:04] <excalibr> helo
[02:23] <fairuz> excalibr: helo
[03:18] <excalibr> fairuz, bila kita assign string ke char pointer eg char *foo = "bar"
[03:18] <excalibr> apa yg berlaku secara teknikalnya
[03:19] <excalibr> /poke fairuz1 
[03:19] <fairuz1> excalibr: oh sorry
[03:20] <excalibr> >fairuz, bila kita assign string ke char pointer eg char *foo = "bar"
[03:20] <fairuz1> maksudnya ko akan ada dalam meory dua benda
[03:20] <excalibr> >apa yg berlaku secara teknikalnya
[03:20] <fairuz1> *memory
[03:21] <excalibr> apa bza kalau assign guna array char foo[] = "bar"
[03:21] <fairuz1> satu ruang direserve untuk simpan "bar", contoh string ni perlukan 4 bytes
[03:21] <fairuz1> jadi tiap2 byte ni ada address dia
[03:22] <fairuz1> dalm kes pertama, foo akan ada nilai address element pertama string ni, dalam kes ni address huruf b
[03:23] <excalibr> ok..pointer ke address "bar" dlm memory..
[03:23] <fairuz1> dalam kes kedua pun sama, foo akan point to the first character
[03:23] <fairuz1> beza dia kat mana "bar" tu disimpan
[03:24] <fairuz1> seingat aku kalau ko pakai char*foo, "bar" tu akan disimpan kat read only memory
[03:24] <fairuz1> so takleh nak tukar
[03:24] <fairuz1> kalau ko pakai char foo[], boleh tuka. e.g. foo[0] = 'T'
[03:27] <fairuz1> excalibr: ok ke 
[03:27] <fairuz1> :p
[03:29] <excalibr> hmm ok :D lagi satu, kalau aku nak reasssign value char pointer tu ke char array..boleh reassign terus ke?
[03:30] <excalibr> char *foo = "bar";
[03:30] <excalibr> char oof[] = "bla";
[03:30] <excalibr> char *foo = oof;
[03:30] <excalibr> ^ ok ke buat camni?
[03:30] <fairuz1> boleh sebab foo tu bukan const pointer
[03:31] <fairuz1> so dia boleh nak assign pegi address lain
[03:31] <fairuz1> Kira nak senang, ko kena ingat pointer ni just simpan address
[03:31] <excalibr> pastu apa jadi dgn original string yg foo tu point masa mula2?
[03:32] <fairuz1> http://ideone.com/m3XIOC
[03:32] <fairuz1> tengok ni
[03:32] <fairuz1> tu takde sapa point kat dia la
[03:32] <fairuz1> dai duk sorang2 la dalam memory tu, kesian dia
[03:32] <fairuz1> *dia
[03:33] <excalibr> hahaa
[03:33] <fairuz1> kalau dari segi technical dia
[03:33] <fairuz1> kalau ko declare benda mcm int i ke
[03:34] <fairuz1> char foo[] = "bar" ke
[03:34] <fairuz1> semua benda ni scope dia auto tak salah aku
[03:34] <fairuz1> jadi dia letak benda ni kat stack scope tu
[03:34] <excalibr> tak perlu erase ke string tadi tu?
[03:34] <fairuz1> so contoh ko declare kat dalam function, abis function, benda ni semua free la
[03:34] <fairuz1> tak perlu kalau auto
[03:34] <fairuz1> *scope auto
[03:35] <fairuz1> kalau ko buat char *foo, scope dia static
[03:35] <fairuz1> takkan hilang sampai program habis
[03:36] <excalibr> oh camtu
[03:36] <fairuz1> benda2 ni static, dia "embedded" dalam data segment program ko tu
[03:37] <fairuz1> Kalau static data ko byk, besar la program ko
[03:37] <fairuz1> kalau auto storage tu, time ko run tu dia reserve memory
[03:37] <excalibr> besar dari segi mem usage?
[03:38] <fairuz1> bukan mem usage, program ko tu yg besar
[03:38] <fairuz1> physically on disk
[03:38] <fairuz1> mem usage ni utk auto storage tu
[03:39] <fairuz1> contoh mcm ni
[03:39] <fairuz1> ko ada variable static 10KB, dengan ko ada declare satu array besar 20KB dalam function X
[03:40] <fairuz1> program ko tu, saiz dia termasuk dengan 10KB variable static tu
[03:40] <fairuz1> kira start2 je program ko, variable static tu dah wujud
[03:40] <fairuz1> array besar tu tak wujud lagi, selagi ko tak masuk dalam function X
[03:41] <fairuz1> X tu tak kesah la function main ke, function buat sendiri ke
[03:44] <excalibr> uhhm..
[03:46] <excalibr> static var ni termasuk la constant kan?
[03:47] <fairuz1> mmg constant pun static var ni
[03:47] <fairuz1> read only
[03:47] <excalibr> eh yg char pointer tadi tu..kdg2 aku tengok org tulis char* foo 
[03:47] <excalibr> apa beza dgn char *foo
[03:49] <fairuz1> sama je
[03:51] <fairuz1> kalau setakat char * tu takpe lagi, kalau dah start main function pointer, kena hati2 je la sikit
[03:51] <fairuz1> contoh function pointer void (*foo)(void)
[03:52] <fairuz1> penting kurungan () tu sebab nak kata benda tu function pointer
[03:54] <fairuz1> ko kenapa tiba2 belaja programming plak ni :D
[03:59] <excalibr> :D
[04:01] <fairuz1> konsep senang mcm ni je,  saiz program = saiz code section + data section
[04:01] <fairuz1> data section dalam kes ni global dengan static variable
[04:01] <fairuz1> global tu, benda2 yang ko declare kat luar main
[04:02] <fairuz1> benda2 yang ko delare dalam main plak, atau dalam mana2 function, takkan ada dalam program ko
[04:02] <fairuz1> unless time runtime, dia akan masuk stack
[04:02] <fairuz1> benda ni la yang aku panggil auto variable tadi
[04:03] <fairuz1> sebab bila dia jumpa penutup function (   }  ), variable2 ni semua akan hilang
[04:16] <excalibr> TIL data section
[04:16] <excalibr> :)
[04:31] <fairuz> :D
[06:19] <excalibr> mcm mana org buat multi patch dlm satu patch file
[06:19] <excalibr> buat patch file satu-satu lepas tu concancate ke satu file?
[06:24] <fairuz> multipatch tu ape maksud ko excalibr
[06:24] <fairuz> patch yg meilibat byk file ke ape
[06:25] <excalibr> ye
[06:37] <fairuz> patch biasa pun boleh melibatkan byk file
[06:38] <fairuz> macam git commit biasa
[06:38] <fairuz> satu commit nak ada diff utk 100 files pun boleh
[06:38] <fairuz> excalibr: ^
[06:58] <faizul> /names
[06:58] <faizul> sorry fairuz 
[06:58] <faizul> silap taip
[07:13] <fairuz> ?
[07:13] <fairuz> excalibr: gigih buat C ke ape keke
[07:43] <excalibr> wahaha
[07:51] <fairuz> aku tengah pening godek spnego Kerberos ni
[08:53] <faizul> hi