[R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'

Duncan Murdoch murdoch at stats.uwo.ca
Sat Apr 19 20:05:31 CEST 2008


On 19/04/2008 1:18 PM, Søren Højsgaard wrote:
> Dear List 
> On windows XP using R.2.6.2 I get the message 
>  
> Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'
>  
> in connection with calling C code (using the .Call interface). I have been unable to find any info on this (in Writing R extensions). Can anyone help me with understanding this error? (In case it helps in tracking the problem: I pass two matrices and a list of several matrices to my C function).

The code that produces that error message is in memory.c:

#ifdef USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS
SEXP (SET_CXTAIL)(SEXP x, SEXP v) {
#ifdef USE_TYPE_CHECKING
     if(TYPEOF(v) != CHARSXP && TYPEOF(v) != NILSXP)
	error("value of 'SET_CXTAIL' must be a char or NULL, not a '%s'",
	      type2char(TYPEOF(x)));
#endif
     /*CHECK_OLD_TO_NEW(x, v); *//* not needed since not properly traced */
     ATTRIB(x) = v;
     return x;
}
#endif /* USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS */

so it looks as though the error message is a little buggy (it should 
print TYPEOF(v), not TYPEOF(x), or maybe it should test x, not v.)   But 
I don't really know what it's doing.  Are you using a STRSXP somewhere 
that is expecting a CHARSXP?

Duncan Murdoch



More information about the R-help mailing list