diff options
author | Nathan Binkert <nate@binkert.org> | 2008-10-10 21:45:35 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2008-10-10 21:45:35 -0700 |
commit | 89f016aacbe92f90c1af98678043f2f6fc82c364 (patch) | |
tree | c67f5b5ad84f12877feeb428d24df8afc64a5ca7 /src/unittest | |
parent | 1f57193439925d2098052d0648031dc04b1ad440 (diff) | |
download | gem5-89f016aacbe92f90c1af98678043f2f6fc82c364.tar.xz |
cprintf: properly deal with pointer types
Diffstat (limited to 'src/unittest')
-rw-r--r-- | src/unittest/cprintftest.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/unittest/cprintftest.cc b/src/unittest/cprintftest.cc index 7fb10375c..1438f194b 100644 --- a/src/unittest/cprintftest.cc +++ b/src/unittest/cprintftest.cc @@ -34,6 +34,7 @@ #include <sstream> #include "base/cprintf.hh" +#include "base/misc.hh" using namespace std; @@ -43,6 +44,14 @@ main() char foo[] = "foo"; cprintf("%s\n", foo); + string _bar = "asdfkhasdlkfjhasdlkfhjalksdjfhalksdjhfalksdjfhalksdjhf"; + int length = 11; + char bar[length + 1]; + bar[length] = 0; + + memcpy(bar, _bar.c_str(), length); + warn("%s\n", bar); + cprintf("%d\n", 'A'); cprintf("%shits%%s + %smisses%%s\n", "test", "test"); cprintf("%%s%-10s %c he went home \'\"%d %#o %#x %1.5f %1.2E\n", |