Consider masking definition of Rf_error()?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- developer-experience
Hướng nghiên cứu
Start with the Rf_error() definition used in C++ contexts and the Rcpp::stop() alternative described in the issue. Review the 35-comment thread to determine whether masking is technically viable and what behavior should replace direct Rf_error() use; done means reaching a decided approach that addresses destructor safety.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Somewhat related to a recent post on R-devel, some users will still try to use Rf_error() in C++ code using Rcpp. However, (as is documented) C++ destructors won't run when a longjmp occurs in cases like this. For example:
#include <Rcpp.h>
using namespace Rcpp;
struct A {
A() { Rprintf("A()\n"); }
~A() { Rprintf("~A()\n"); }
};
// [[Rcpp::export]]
SEXP uhoh() {
A a;
Rf_error("Oops!");
}
/*** R
uhoh()
*/
In this example, ~A() is never printed.
We could consider masking the definition of Rf_error() in these contexts. For example, something like:
#define Rf_error(...) \
static_assert(false, "Use of Rf_error() in C++ contexts is unwise: consider using Rcpp::stop() instead.");
There might also be a way to provide our own definition of Rf_error() that "masks" the version provided by R, but I wasn't able to find something immediately obvious.
- Ngôn ngữ chính
- C++
- Star
- 799
- Fork
- 219
- Merge trung bình
- 5 giờ 13 phút
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RcppCore/Rcpp
-
Consider -Wconversion warnings Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của RcppCore/Rcpp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
gazebosim/gz-sensors#662 · 1 bình luận ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
comp-datalake
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
ClickHouse/ClickHouse#121222 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
LadybirdBrowser/ladybird#12123 ·