|
From: | Nowlan, Sean |
Subject: | Re: [Discuss-gnuradio] runtime errors vs. logic errors |
Date: | Mon, 16 Apr 2012 01:02:31 +0000 |
Sorry for the re-post; forgot to include the attachment. From: discuss-gnuradio-bounces+address@hidden [mailto:discuss-gnuradio-bounces+address@hidden
On Behalf Of Nowlan, Sean Kind of a nitpicky C++ thing, but shouldn’t argument checks on the access code in gr_correlate_access_code_tag_bb.cc throw std::invalid_argument or std::range_error, which are both derived from std::runtime_error, versus std::out_of_range,
which is derived from std::logic_error? My understanding is that the latter is used for cases such as referencing index 11 in a string that was declared to have length 10, etc, whereas the former are used for checking user-supplied parameters. A quick “ find.
| xargs grep out_of_range” yields the attached output. It looks like the uses in /src/lib/swig/guile/std_vector.i are correctly used (popping from an empty vector, referencing an out-of-bounds index, etc.) but the other cases should be invalid_argument. Thoughts?
If this gets the go-ahead, I’ll make a patch sometime this week. Thanks, Sean |
grep_out_of_range.txt
Description: grep_out_of_range.txt
[Prev in Thread] | Current Thread | [Next in Thread] |