-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/436/
-----------------------------------------------------------

Review request for Default, Ali Saidi, Gabe Black, Steve Reinhardt, and Nathan 
Binkert.


Summary
-------

This discussion of reference counting brings up an interesting issue that came 
up with a different project of mine.  That is constness.  Often people use Foo 
* and const Foo *, but as the class is currently written, we can't do that 
properly with our refcount stuff.  There are a few simple changes that do make 
this work (see diff).  The essential issue is that the reference count itself 
should be mutable, and the methods that access the actual pointer in the smart 
pointer class should be const (since you're not changing the smart pointer when 
you're accessing them).

Anyway, there's no rush or really even any need on my part for this, but in 
theory, we are doing it wrong and if people are trying to use "const FooPtr", 
they're probably doing the wrong thing.  I could just leave well enough alone 
and not touch this, or if people agree that what we have is wrong, I can make 
sure that this diff is correct run regressions, and commit it.

This would mean using two typedefs:
typedef RefCountingPtr<Foo> FooPtr;
typedef RefCountingPtr<const Foo> ConstFooPtr;


Diffs
-----

  src/base/refcnt.hh de7601e6e19d 

Diff: http://reviews.m5sim.org/r/436/diff


Testing
-------


Thanks,

Nathan

_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to