How can I use dynamic arrays in Polyspace 5.1 (R2008a)?

1 回表示 (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2011 年 12 月 28 日
Dynamic arrays are possible in C with compilers supporting the C99 standard.
PolySpace supports only C90 so an analysis using this construct will fail with a compilation error.

採用された回答

MathWorks Support Team
MathWorks Support Team 2011 年 12 月 28 日
There is no way to make PolySpace accept dynamic arrays without modifying the source code that is being analyzed.
Please consider the following:
Replace this syntax
void foo(unsigned char a)
{
char b[a];
}
with this
void foo(unsigned char a)
{
#ifndef POLYSPACE
char b[a];
#else
char *b = (char *) malloc(sizeof(char) * a);
#endif
}

その他の回答 (0 件)

製品


リリース

リリースが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by