See jetspeed 1 site httpportalsapacheorgjetspeed 1

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: m; strm.setstate (strm.failbit); char s [3] = { 'x', 'y', 'z' }; strm.getline (s, 2); assert ('\0' == s [0]); assert ('y' == s [1]); assert ('z' == s [2]); } gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long t.cpp gcc t.o -o t -L/build/sebor/gcc-3.4.3-15s/rwtest -lrwtest15s -pthreads -L/build/sebor/gcc-3.4.3-15s/lib -lstd15s -lsupc++ -lm Assertion failed: '\0' == s [0], file t.cpp, line 13 Abort (core dumped) std::istream::get(char*, size_type) doesn't store NUL on failure The program below aborts at runtime. According to, "...if the sentry constructor [of an unformatted input function] exits by throwing an exception or if the sentry object returns false, when converted to a value of type bool, the function returns without attempting to obtain any input. In either case [...] unformatted input functions taking a character array of non-zero size as an argument shall also store a null character (using charT()) in the first location of the array." $ cat t.cpp && nice make t -r && ./t #include <cassert> #include <sstream> int main () { std::istringstream strm; strm.setstate (strm.failbit); char s [3] = { 'x', 'y', 'z' }; strm.get (s, 2); assert ('\0' == s [0]); assert ('y' == s [1]); assert ('z' == s [2]); } gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -pthreads -D_RWSTD_USE_CONFIG -I/build/sebor/gcc-3.4.3-15s/include -I/build/sebor/dev/stdlib/include -I/build/sebor/dev/stdlib/../rwtest -I/build/sebor/dev/stdlib/../rwtest/include -I/build/sebor/dev/stdlib/tests/include -pedantic -nostdinc++ -g -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -W...
View Full Document

This document was uploaded on 10/12/2012.

Ask a homework question - tutors are online