qsort in standard library for DSC / MC56F800

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

qsort in standard library for DSC / MC56F800

1,364件の閲覧回数
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,161件の閲覧回数
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 件の賞賛
返信