qsort in standard library for DSC / MC56F800

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

qsort in standard library for DSC / MC56F800

1,362 次查看
spacedog
Contributor I

Is the qsort() library function implemented as recursive function or not.

 

From MISRA 2012, Rule 21.9, page 170

 

The implementation of qsort is likely to be recursive and will therefore place unknown demands on stack resource. This is of concern in embedded systems as the stack is likely to be a fixed, often small size.

 

This rule raises a good question. I plan to use this function. As I want to be on the safe side I would like to have this question answered.

标签 (1)
0 项奖励
回复
1 回复

1,159 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Colin,

You are right, the DSC chip has limited internal SRAM, the stack space is predefined in the linker file when you compile the project, you have to predict the recursive loop number and allocate the corresponding stack space, it is not possible to allocate stack dynamically in application code.

Hope it can help you.

BR

Xiangjun Rong

0 项奖励
回复