Thank you very much for the great explanation!
Casting between them is undefined behavior, probably resulting in a segfault.
Well, all I was getting was a -1 from execvp, so didn't really know what was going on. I also don't know how to handle C errors in Nim. I certainly did not get an exception from the casting process.
Well, all I was getting was a -1 from execvp, so didn't really know what was going on. I also don't know how to handle C errors in Nim.
You would do it exactly like how you would in C. posix.errno, os.osLastError() can be used to retrieve the error (we also have a proc for converting those into exceptions, see os.raiseOSError()). You may want to refer to the manual page for execvp to know what error to expect if you want to handle them.
I certainly did not get an exception from the casting process.
Nim's cast is unsafe. By using them you are telling the compiler that "I know what I am doing", and it will not generate conversion checking code.
That explains it, I understand now.
Thanks to you both for the great explanations and the effort in answering my questions.