<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]
<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