Help save net neutrality! Learn more.
Close

#79 poly: 1. wrong comments, 2. perhaps "assert" preconditions

open-fixed
asl (8)
5
2011-06-20
2009-04-27
No

Hi,

I was reading through <poly.hpp> source on ASL web [1].

1. There are wrong comments on lines 128, 170 - they accompany friend function, but mention "this": "// Precondition : this->type_info() == x.type_info()" --> solution: "this" should be "x" and "x" should be "y" (this comment was probably simply copy/pasted from above cases, where it is correct)

2. For the 2 functions mentioned above and other ones where there is a comment about a precondition - why not add an "assert(this->type_info() == x.type_info());" to the code? (I am still trying to figure the code out, but asserting preconditions looks like the right thing to do in debug builds).

Thanks,
Boris

[1]: http://stlab.adobe.com/poly_8hpp-source.html

Discussion

  • Mat Marcus

    Mat Marcus - 2011-06-20

    Thanks for the report. I submitted a fix. If you are interested in learning more about poly.hpp's implementation, there is a paper describing a slightly older version at http://www.emarcus.org/#mpool_2007

     
  • Mat Marcus

    Mat Marcus - 2011-06-20
    • assigned_to: nobody --> mmarcus
    • status: open --> open-fixed
     
  • Boris Dušek

    Boris Dušek - 2011-06-20

    Good to hear about the fix and thanks for the link to the paper which I will be sure to read.

     

Log in to post a comment.