- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider this simple program:
#include <string> #include <assert.h> void foo(const std::string& str) { assert(str[0] != 0); } int main() { foo("Test longer than 32 characters like this"); return 0; }
If the string passed to foo() is longer than 32 characters, then the assert throws an error. Detailed inspection shows first 16 characters of 'str' to be filled with 0 (therefore the string is - unexpectedly - altered)! Any workarounds?
Ray
InspectorXE 2016 - Update 2
Visual Studio 2015 Community
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
What type of Inspector analysis are you running?
It sounds like you might be running into a memory checker guard zone.
Can you try running a level 2 "Detect memory problems" analysis?
I'll run your example and see if under which conditions the issue duplicates.
Regards,
Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
It happens only when running with "Enable debugger when problem detected" option (level 2 or 3). At Level 1 or with "Analyze without debugger", no problems are encountered.
Ray
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tested your example using the 2017 beta version of Inspector.
I'm not seeing the issue with this version. Can you try the 2017 beta?
Kevin
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page