I have a suggestion to improve debugging. When I use a vec with a pointer sometimes I misstakenly write out of bounds. In debug I have added FILE and LINE to the it_assert0() call. This will tell me the line number and file of my code as well as the itpp code.
I think it is a very good idea as probably the most common cause of troubles is running out of vector indexes. I tried your patch using GCC 3.4.3. Unfortunately this will not compile in this form. The compiler complains about the << operators. I assume this is because, as I read somewhere, starting from GCC 3.4.0 FILE, LINE and the like are treated as regular variables instead of preprocessor substitutions. Probably it_assert_f must be then altered to accept more than two arguments (?).
But I'm still very interested in such a solution which enables your idea under GCC 3.4 :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tested the proposed scheme on gcc 3.3.3 on I do not get it to work. Furthermore, rewriting the assert to a cout instead using FILE and LINE only give error report to vec.h and the corresponding line. Hence, I cannot see that we can solve this problem. It would have been nice, though.
/Tony
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a suggestion to improve debugging. When I use a vec with a pointer sometimes I misstakenly write out of bounds. In debug I have added FILE and LINE to the it_assert0() call. This will tell me the line number and file of my code as well as the itpp code.
Here is an example of the change that I made:
file vec.h line 239
Anyone have any other suggestions?
Michael
I think it is a very good idea as probably the most common cause of troubles is running out of vector indexes. I tried your patch using GCC 3.4.3. Unfortunately this will not compile in this form. The compiler complains about the << operators. I assume this is because, as I read somewhere, starting from GCC 3.4.0 FILE, LINE and the like are treated as regular variables instead of preprocessor substitutions. Probably it_assert_f must be then altered to accept more than two arguments (?).
But I'm still very interested in such a solution which enables your idea under GCC 3.4 :)
Hi,
I have tested the proposed scheme on gcc 3.3.3 on I do not get it to work. Furthermore, rewriting the assert to a cout instead using FILE and LINE only give error report to vec.h and the corresponding line. Hence, I cannot see that we can solve this problem. It would have been nice, though.
/Tony