| |
| Posted by FUKUDA, Fumiki | PermalinkReply |
|
FUKUDA, Fumiki
| #include <iostream>
#include <cassert>
int half(int n)
__in { assert( n > 0 ); }
__out (result) { assert(result+result < n); }
__body
{
return n/2;
}
int main() {
std::cout << "Hello, world" << half(-5) << std::endl;
return 0;
}
this code reports compile error under DMC841C+STLport
even if '-D' is NOT specified. why? what should I do?
__in { assert( n > 0 ); }
^
foo.cpp(5) : Error: '__stl_in' is not in function par
__out (result) { assert(result+result < n); }
^
foo.cpp(6) : Error: '=', ';' or ',' expected
}
^
foo.cpp(10) : Error: '=', ';' or ',' expected
return 0;
^
foo.cpp(14) : Error: '=', ';' or ',' expected
}
^
foo.cpp(15) : Error: '=', ';' or ',' expected
Fatal error: too many errors
|