c++ - DBC and stlport
when I learn DBC (see following program), I find if I include stlport in sc.ini ,dmc will display error ,and when i not use stlport include ,it is ok. ====================================================================== { ^ zj4.cpp(21) : Error: '__stl_in' is not in function parameter list } ^ zj4.cpp(23) : Error: '=', ';' or ',' expected } ^ zj4.cpp(27) : Error: '=', ';' or ',' expected b = a*a; ^ zj4.cpp(32) : Error: 'b' is not in function parameter list return b; ^ zj4.cpp(34) : Error: '=', ';' or ',' expected Fatal error: too many errors --- errorlevel 1 ========================================================================= #include <stdio.h> #include <assert.h> int hi(int a); int main() { int a; int i; for(i=0; i<10; i++){ a = hi(i); printf("i=%d a=%d\n",i, a); } return 0; } int hi(int a) __in { assert(a<6); } __out(result) { assert(result<10); } __body { int b; b = a*a; return b; }
Feb 17 2003
stlport has a #define to convert __in to __stl_in. You'll need to do without one or the use of __in in your code. Or you can #undef __in. "budzhang" <budzhang sina.com> wrote in message news:b2sf0e$2d6i$1 digitaldaemon.com...when I learn DBC (see following program), I find if I include stlport in sc.ini ,dmc will display error ,and when i not use stlport include ,it is ok. ====================================================================== { ^ zj4.cpp(21) : Error: '__stl_in' is not in function parameter list } ^ zj4.cpp(23) : Error: '=', ';' or ',' expected } ^ zj4.cpp(27) : Error: '=', ';' or ',' expected b = a*a; ^ zj4.cpp(32) : Error: 'b' is not in function parameter list return b; ^ zj4.cpp(34) : Error: '=', ';' or ',' expected Fatal error: too many errors --- errorlevel 1 ========================================================================= #include <stdio.h> #include <assert.h> int hi(int a); int main() { int a; int i; for(i=0; i<10; i++){ a = hi(i); printf("i=%d a=%d\n",i, a); } return 0; } int hi(int a) __in { assert(a<6); } __out(result) { assert(result<10); } __body { int b; b = a*a; return b; }
Feb 18 2003