HenrikBengtsson / matrixStats

R package: Methods that Apply to Rows and Columns of Matrices (and to Vectors)
https://cran.r-project.org/package=matrixStats
203 stars 33 forks source link

Consider defining STRICT_R_HEADERS #199

Closed 1e100 closed 3 years ago

1e100 commented 3 years ago

Without this define Rcpp will export some macros that are very likely to clash with third party code such as e.g. Calloc and Free. One example is Protocol Buffers which people use to store data to disk. In Protocol Buffers, for example, include/google/protobuf/arena_impl.h would like to be able to define a member function named Free, and it cannot do so if RS.h is already in scope. That's very problematic.

Needless to say, this problem is not limited to Protocol Buffers. Anything that would like to define functions that clash with these very "clashy" macros will have problems. Sometimes those problems can be awkwardly and temporarily solved by ordering the header includes, but mostly they're a thorn in the side. To make matters worse the error produced by the compiler is incomprehensible, and therefore less skilled developers may not be able to diagnose the root cause.

See more discussion here: https://github.com/RcppCore/Rcpp/issues/898

HenrikBengtsson commented 3 years ago

Thanks. So, this is the first time i hear about STRICT_R_HEADERS, and I'm not following. Can you please explain what the problem is in regards to matrixStats. Also, you mention Rcpp - where does that come into the picture?

1e100 commented 3 years ago

My bad, meant to file this elsewhere. You don't use Rcpp.