asterite changed the topic of #crystal-lang to: #crystal-lang The Crystal programming language | http://crystal-lang.org | Crystal 0.6.1 | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal - Docs: http://crystal-lang.org/docs/ - API: http://crystal-lang.org/api/ - Logs: http://irclog.whitequark.org/crystal-lang
zipR4ND has quit [Ping timeout: 265 seconds]
bcardiff has joined #crystal-lang
waterlink1 has joined #crystal-lang
waterlink has quit [Ping timeout: 264 seconds]
waterlink1 has quit [Ping timeout: 265 seconds]
bcardiff has quit [Quit: Leaving.]
DerisiveLogic has quit [Ping timeout: 265 seconds]
DerisiveLogic has joined #crystal-lang
<a5i> >> s = Pointer(Char); s.value = "hello world"; s.value
<DeBot> a5i: Error in line 3: undefined method 'value=' for Pointer(Char):Class
<a5i> >> s = Pointer(String); s.value = "hello world"; s.value
<DeBot> a5i: Error in line 3: undefined method 'value=' for Pointer(String):Class
<a5i> >> s = Pointer(String).malloc(10); s.value = "hello world"; s.value
<DeBot> a5i: "hello world"
<a5i> >> s = Pointer(Char).malloc(10); s.value = "hello world"; s.value
<DeBot> a5i: Error in line 3: no overload matches 'Pointer(Char)#value=' with types String
<a5i> >> def test; test; end;
<DeBot> a5i: nil
<a5i> >> def test(x); test(1); end;
<DeBot> a5i: nil
a5i has quit []
a5i has joined #crystal-lang
<a5i> Question
<a5i> whats the differnce between segmentation fault
<a5i> and
<a5i> >> ptr = Pointer(Int32).malloc(1); ptr[0-ptr.address]
<DeBot> a5i: Program terminated abnormally with error code: 139
<a5i> also whats this?
<a5i> >> x :: Int32; puts x
<DeBot> a5i: 134559244
<a5i> like...
<a5i> >> x :: String; puts x
<DeBot> a5i: IndexOutOfBounds: Index out of bounds
<a5i> >> x :: f64; puts x
<DeBot> a5i: Syntax error in eval:3: expecting token 'CONST', not 'f64'
<a5i> >> x :: Float64; puts x
<DeBot> a5i: 5.02315e-270
<a5i> >> x :: Nil; puts x
<DeBot> a5i:
<a5i> >> x :: Char; puts x
<DeBot> a5i: Exception: Invalid char value
bcardiff has joined #crystal-lang
bcardiff has quit [Client Quit]
a5i has quit [Quit: Connection closed for inactivity]
ponga has joined #crystal-lang
Ven has joined #crystal-lang
BlaXpirit has joined #crystal-lang
strcmp2 has joined #crystal-lang
strcmp1 has quit [Ping timeout: 256 seconds]
zipR4ND has joined #crystal-lang
zipR4ND has quit [Ping timeout: 256 seconds]
ponga has quit [Quit: Leaving...]
cool_coder_forfo has joined #crystal-lang
DerisiveLogic has quit [Ping timeout: 240 seconds]
DerisiveLogic has joined #crystal-lang
DerisiveLogic has quit [Remote host closed the connection]
DerisiveLogic has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cool_coder_forfo has left #crystal-lang [#crystal-lang]
JBat has joined #crystal-lang
waterlink has joined #crystal-lang
ponga has joined #crystal-lang
a5i has joined #crystal-lang
DerisiveLogic has quit [Remote host closed the connection]
ponga has quit [Remote host closed the connection]
waterlink has quit [Ping timeout: 246 seconds]
havenwood has quit [Remote host closed the connection]
ssvb has quit [Ping timeout: 245 seconds]
ponga has joined #crystal-lang
ssvb has joined #crystal-lang
bjmllr has quit [Remote host closed the connection]
bjmllr has joined #crystal-lang
Ven has joined #crystal-lang
ssvb has quit [Ping timeout: 248 seconds]
ssvb has joined #crystal-lang
ssvb has quit [Ping timeout: 248 seconds]
ssvb has joined #crystal-lang
ssvb has quit [Ping timeout: 265 seconds]
ssvb has joined #crystal-lang
havenwood has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
asterite has joined #crystal-lang
<asterite> Yes, just didn't have time to reply
<asterite> Short answer: operations on pointers are unsafe, you can get segfaults and the compiler won't help you
<a5i> is the error code a segfault though?
<a5i> should be, but I dont know error codes vs segfaults
<asterite> I get "Segmentation fault: 11" when I run it
<a5i> asterite, ah, what about this?
<a5i> >> x :: Int32; puts x
<DeBot> a5i: 134559244
<asterite> x :: … is unsafe, it declares a variable with garbage
<asterite> mostly used for declaring buffers which you don't want to initialize for performance reasons
<asterite> Basically, the compiler won't help you with anything involving unsafe operations
<asterite> I have to write the unsafe parts somewhere, I think they are just three or four
<a5i> will it ever in the future? would be a great feature if it did :P
<asterite> pointers, allocate, C bindings and ::
<jhass> I'm still +1 to zero out everything, yeah ;)
<asterite> jhass: I think that's a possibility too, yes
<asterite> I'll have to do some performance tests for buffers
<asterite> But if you want zero you can do: x = 0; ptr = Pointer(Int32).null; StaticArray(Int32, 8).new(0) and so on
<jhass> how do I zero a C struct?
<a5i> someone needs to create a rootkit in Crystal :P
<jhass> a5i: rootkit that depends on gc? hf
<asterite> jhass: C::Struct.new
<jhass> ah right, that one does zero, nvm
<a5i> couldnt we disable the gc @ asterite ?
<asterite> You can use gc/null but you'll have memory leaks
<asterite> Or you can do GC.disable, but that still includes a GC in the binary
<asterite> (I know nothing about rootkit)
<jhass> it's no well defined term anyway
<jhass> a rootkit is something that places itself between OS <-> application or these days often even hardware <-> OS and hides itself and its malicious actions
<jhass> how it achieves that exactly is free to interpretation anyway I'd sa
<jhass> *say
<asterite> I wonder if we can make crystal only generate benign programs
<jhass> well, a hypervisor is pretty much the same thing for the hardware <-> OS type ;P
Ven has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
havenwood has quit [Remote host closed the connection]
Ven has joined #crystal-lang
waterlink has joined #crystal-lang
havenwood has joined #crystal-lang
DerisiveLogic has joined #crystal-lang
waterlink has quit [Ping timeout: 256 seconds]
bcardiff has joined #crystal-lang
<strcmp2> jhass, why does the gc matter though
<jhass> -rwxr-xr-x 1 root root 153K Sep 11 2014 /usr/lib/libgc.so.1.0.3
<jhass> that's quite a few extra bytes
<strcmp2> hm it adds too much overhead to the size of the binary you're saying?
<jhass> that's one argument yes
<jhass> also you can't really control its execution
<jhass> so it might make it easier to detect
<jhass> I think it runs an extra thread too?
<jhass> never checked
<strcmp2> im not sure how libgc works, but ive seen a few projects use it
<strcmp2> maybe streem uses it?
<strcmp2> i cant remember :)
<strcmp2> yeah it does
<strcmp2> before that it had no GC at all :D https://github.com/matz/streem/issues/85
<jhass> mh, http://www.hboehm.info/gc/ doesn't load for me atm for whatever reason, but iirc it had a list of projects that use it
<strcmp2> seems like a great way to auto-manage memory in C
bcardiff has quit [Quit: Leaving.]
ponga has quit [Quit: Leaving...]
BlaXpirit_ has joined #crystal-lang
BlaXpirit has quit [Ping timeout: 265 seconds]
waterlink has joined #crystal-lang
BlaXpirit_ has quit [Quit: Quit Konversation]
BlaXpirit has joined #crystal-lang
zipR4ND has joined #crystal-lang
asterite1 has joined #crystal-lang
asterite has quit [Ping timeout: 245 seconds]
shama has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
strcmp2 has quit [Quit: Leaving]
DerisiveLogic has quit [Read error: Connection reset by peer]
DerisiveLogic has joined #crystal-lang
asterite1 has quit [Ping timeout: 252 seconds]
strcmp1 has joined #crystal-lang
waterlink has quit [Ping timeout: 240 seconds]
waterlink has joined #crystal-lang
strcmp1 has quit [Remote host closed the connection]
a5i has quit [Quit: Connection closed for inactivity]
JBat has quit [Quit: Computer has gone to sleep.]
havenwood has quit []
<crystal-gh> [crystal] asterite pushed 4 new commits to master: http://git.io/vfWdY
<crystal-gh> crystal/master bf2912d Ary Borenszweig: Fixed #568: fix Array#+ for mixed types by changing the way Pointer#copy_from and others are implemented
<crystal-gh> crystal/master c2da163 Ary Borenszweig: Small fixes and enhancements
<crystal-gh> crystal/master ab3830a Ary Borenszweig: Fixed #570: raise IO::EOFError in IO#read_full
BlaXpirit has quit [Quit: Quit Konversation]
havenwood has joined #crystal-lang
<travis-ci> manastech/crystal#2254 (master - a62b20f : Ary Borenszweig): The build was broken.
DerisiveLogic has quit [Ping timeout: 256 seconds]
a5i has joined #crystal-lang