Are there any risks to using stdlib qsort() on an MQX 4.2 Kinetis K60 system?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Are there any risks to using stdlib qsort() on an MQX 4.2 Kinetis K60 system?

跳至解决方案
1,134 次查看
dmitriyc
Contributor III

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?

标记 (2)
0 项奖励
回复
1 解答
915 次查看
Carlos_Musich
NXP Employee
NXP Employee

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

在原帖中查看解决方案

0 项奖励
回复
1 回复
916 次查看
Carlos_Musich
NXP Employee
NXP Employee

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

0 项奖励
回复