Skip to content
Prev 472 / 10988 Next

[Rcpp-devel] ColDatum constructors memory safety

Here are patches to RcppFrame.h:

--- RcppFrame.h~        2010-02-16 10:54:01.000000000 -0500
+++ RcppFrame.h 2010-03-16 19:48:29.847994574 -0400
@@ -30,7 +30,8 @@
 enum ColType {                 // Supported data frame column types.
     COLTYPE_DOUBLE, COLTYPE_INT, COLTYPE_STRING,
     COLTYPE_FACTOR, COLTYPE_LOGICAL,
-    COLTYPE_DATE, COLTYPE_DATETIME
+    COLTYPE_DATE, COLTYPE_DATETIME,
+    COLTYPE_UNKNOWN = -1
 };
 class ColDatum;                        // forward declaration, see below


and RcppFrame.cpp:


--- RcppFrame.cpp~      2010-03-12 15:11:45.000000000 -0500
+++ RcppFrame.cpp       2010-03-16 19:48:30.517076368 -0400
@@ -22,7 +22,7 @@

 #include <RcppFrame.h>

-ColDatum::ColDatum() : level(0) { }
+ColDatum::ColDatum() : type(COLTYPE_UNKNOWN), level(0) { }

 ColDatum::ColDatum(const ColDatum& datum) {
     // Need deep copy so contruction/destruction is synchronized.
On Sat, Mar 13, 2010 at 12:03 PM, Dirk Eddelbuettel <edd at debian.org> wrote: