diff --git a/说明文档/开发流程.md b/说明文档/开发流程.md index e289a18..1f1ee12 100644 --- a/说明文档/开发流程.md +++ b/说明文档/开发流程.md @@ -37,11 +37,11 @@ CosyOS支持高等级优化,您完全可以选择8级(default),speed偏 原因是C51的可重入栈效率十分低下,对于XBPSTACK,还存在关中断行为。
对于不可重入的库函数或自定义函数,如需要可重入,可采用下述的方法。
(1)替换法:对于不可重入的库函数,可考虑替换为其它的可重入库函数,实现相同的功能。
-| non-reentrant | reentrant | 替换条件 | -|--------------------|--------------------------------|----| -| strncpy(s1, s2, n) | memcpy(s1, s2, n) | 推荐s2的长度至少为n | -| strncat(s1, s2, n) | memcpy(s1 + strlen(s1), s2, n) | 推荐s2的长度至少为n | -| strcat(s1, s2) | strcpy(s1 + strlen(s1), s2) | 无 | +| non-reentrant | reentrant | 替换条件 | +|--------------------|--------------------------------|----------------------------------| +| strncpy(s1, s2, n) | memcpy(s1, s2, n) | 推荐s2的有效长度至少为n | +| strncat(s1, s2, n) | memcpy(s1 + strlen(s1), s2, n) | 推荐s2的有效长度至少为n | +| strcat(s1, s2) | strcpy(s1 + strlen(s1), s2) | 无 | | strncmp(s1, s2, n) | memcmp(s1, s2, n) | 确保其中一个字符串的有效长度至少为n | (2)可重入版本