Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - robly18

Pages: [1]
1
Calculator C / Re: OS cleaning up things after program is off?
« on: September 22, 2015, 05:48:04 pm »
(Sorry for taking so long... School just started.)

Okay so, after trying again I guess it worked. Don't know why I thought it did the first few tries. The first few, there must have been no output, and after I added error checking, when I mistakenly assumed fprintf would return 0 on success, I came to the conclusion that it had failed...

Thanks for all your help!

2
Calculator C / Re: OS cleaning up things after program is off?
« on: September 10, 2015, 08:31:45 am »
Thank you so so so much for your help!

Quote
It's gonna feel weird having to take actual measures to get out of a crash.
Well, if your program crashes, it's not possible to recover and the calc resets.
abort and std::terminate (C++) are caught and it tries to recover from it, but that's not possible sometimes.

Maybe crash isn't the proper word.. I meant as in, failure to read a file and I end up aborting for example. On the computer all I have to do is have the program quit, but here I see myself implementing some ad-hoc version of exceptions using gotos.


Quote
EDIT: Bonus third (sorry for so many!), is there any way to track allocated memory so that I may be able to find out if my program has a memory leak?
There is no valgrind for ndless, but you can try to modify libsyscalls in the Ndless-SDK a bit to print something on each malloc and free and track it manually over the serial port or have an internal counter: https://github.com/ndless-nspire/Ndless/blob/master/ndless-sdk/libsyscalls/stdlib.cpp#L104


How would I go about, say, logging things to a file perhaps? I've tried using the C IO functions, but I found myself unable to write things? It created the file and everything, but failed when I tried to write to it.

3
Calculator C / Re: OS cleaning up things after program is off?
« on: September 08, 2015, 09:50:54 am »
Thanks. So, unlike on most computers, I have to make sure all cleanup is done then, got it.

It's gonna feel weird having to take actual measures to get out of a crash.

Also, two extra questions:
1- Is there any risk stemming from pointer shenanigans? Like, say I forget to assign a pointer and write to it. Is there any chance of me permanently messing up my calculator?

2- This one should be more evident but I trust that malloc'd memory is freed upon calculator reset?

EDIT: Bonus third (sorry for so many!), is there any way to track allocated memory so that I may be able to find out if my program has a memory leak?

4
Calculator C / OS cleaning up things after program is off?
« on: September 07, 2015, 08:34:01 pm »
So I recently got into TI-Nspire CX programming, and I've had this looming worry... Does the OS deal with cleanup after program exit? i.e. say I malloc some memory and exit without freeing it. Does the OS recognize that it should be freed?

Furthermore, say I open a file and then shut down the program without closing  it. Would there be any problems stemming from that?

TIA

Pages: [1]