Hello,
I would like to sort an array of structs and the qsort() in stdlib.h looks like a good solution as opposed to rolling my own sort function. I don't need that much speed, so the generic standard function should be fine for this. Are there any dangers in doing this? For example, is the qsort() implemented as a recursive function, creating the need to be very careful with the task's stack size?
Has anyone else had experience using qsort in an MQX system?
Solved! Go to Solution.
Hi dmitriyc,
As you say... You must be very careful with the task stack. I have not tried qsort() or other recursive functions. But in my experience I saw that printf() using floats will overflow a task's stack very fast.
Best regards,
Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi dmitriyc,
As you say... You must be very careful with the task stack. I have not tried qsort() or other recursive functions. But in my experience I saw that printf() using floats will overflow a task's stack very fast.
Best regards,
Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------