> On July 27, 2012, 12:14 a.m., Andreas Hansson wrote:
> > src/base/str.hh, line 149
> > <http://reviews.gem5.org/r/1324/diff/1/?file=28294#file28294line149>
> >
> >     Any particular reason for the C style strings instead of C++ STL 
> > strings?

There are places (well at least one place) where both strings are C strings and 
not STL strings, so we need this overloaded version so that we can use this 
function without an explicit cast at the call site.  So as far as I can tell 
all three of these different versions are necessary if we want to avoid 
conversions at the call sites.

This C-string-only version could be implemented by converting 's' to an STL 
string and then using compare (or more specifically then calling one of the 
other overloaded versions), but that seems like more overhead than just calling 
strncmp.  If there's a good reason to avoid calling strncmp, though, I'm 
willing to change, as I don't think performance is all that critical here.


- Steve


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.gem5.org/r/1324/#review3159
-----------------------------------------------------------


On July 26, 2012, 4:55 p.m., Steve Reinhardt wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.gem5.org/r/1324/
> -----------------------------------------------------------
> 
> (Updated July 26, 2012, 4:55 p.m.)
> 
> 
> Review request for Default.
> 
> 
> Description
> -------
> 
> Changeset 9131:f1095e71a98d
> ---------------------------
> str: add an overloaded startswith() utility method
> for various string types and use it in a few places.
> 
> 
> Diffs
> -----
> 
>   src/base/hostinfo.cc UNKNOWN 
>   src/base/str.hh UNKNOWN 
>   src/sim/syscall_emul.hh UNKNOWN 
>   src/sim/system.cc UNKNOWN 
> 
> Diff: http://reviews.gem5.org/r/1324/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Steve Reinhardt
> 
>

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to