Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
1 6
Newest
 Yearling
Impact
~647 people reached

  • 0 posts edited
  • 0 helpful flags
  • 86 votes cast
Aug
22
comment Philosophy behind Undefined Behavior
boost::weak_ptr's implementation is a pretty good template to start with for this usage pattern. Rather than tracking and nullifying weak_ptrs externally, a weak_ptr just contributes to the shared_ptr's weak count, and the weak count is basically a refcount to the pointer itself. Thus, you can nullify the shared_ptr without having to delete it immediately. It's not perfect (you can still have lots of expired weak_ptrs maintaining the underlying shared_count for no good reason) but at least it's fast and efficient.
Aug
17
awarded  Teacher
Aug
16
awarded  Editor
Aug
16
revised Is it a good idea to use Header(“Content-Type […]”); in the core file of a CMS?
deleted 1 characters in body
Aug
16
answered Is it a good idea to use Header(“Content-Type […]”); in the core file of a CMS?
Aug
16
comment Do you use i-->0 for backward loops?
@davidk01 The pre/post-inc/decrement operators are a basic part of the C language, and have been adopted by quite a few other languages as well. You probably should learn them someday.
Aug
10
comment Philosophy behind Undefined Behavior
Also remember that not every CPU has an MMU to guard against invalid accesses in hardware to begin with. If you start requiring your language to check all pointer accesses, then you have to emulate an MMU on CPUs without one - and thus EVERY memory access becomes extremely expensive.
Aug
10
awarded  Supporter
Aug
1
awarded  Autobiographer