[Rd] Problem with types on 64-bit

Oleg Sklyar osklyar at ebi.ac.uk
Fri Feb 23 00:11:28 CET 2007


Besides the comments from Prof. Ripley, I am not sure your if statement 
is fully correct, because suppose v_dta_start is R_NilValue -- why then 
STRING_ELT( R_NilValue, 0 ) should be a valid statement in first place? 
In my code I often use R_NilValue to check for R-NULL, but it always 
works fine on both 32 and 64 bits, moreover on Linux, Mac and Windows as 
well... Oleg

tom at levelelimited.com wrote:
> Hi Everyone,
> 
> I have a problem using some working 32-bit R code with 64-bit machine ( I am
> using version R-2.4.1 ).  The problem occurs when I am trying to detect a NULL
> STRSXP type. ( Perhaps I am doing this detection in the wrong way? )
> 
> On 32-bit the following works, and correctly identifies if I am passing NULL
> or a valid string object:
> 
> if ( v_dta_start != R_NilValue && STRING_ELT( v_dta_start, 0 ) != R_NilValue )
> {
>     dta.start = CHAR( STRING_ELT( v_dta_start, 0 ) );
> }
> 
> Yet on a 64-bit machine I get the following errors:
> 
> (1) when I pass NULL it goes into the if clause and then when it tries to set
> dta.start it displays:
> CHAR() can only be applied to a 'CHARSXP', not a 'NULL'
> (2) if I pass a valid string such as "hello", I get the following:
> CHAR() can only be applied to a 'CHARSXP', not a 'character'
> 
> I have tried converting using AS_CHARACTER but that just brings up the same
> messages.  I have also seen S4 and PROMSXP types come up in these error
> messages.  
> 
> What I don't understand is why this happens - any ideas?
> 
> If I can supply any more info let me know, below is the CPU information for
> the 64-bit machine. 
> 
> Many thanks for your help
> 
> Tom
> 
> 64-BIT CPU INFO
> ===============
> 
> processor	: 0
> vendor_id	: AuthenticAMD
> cpu family	: 15
> model		: 5
> model name	: AMD Opteron(tm) Processor 144
> stepping	: 10
> cpu MHz		: 1794.932
> cache size	: 1024 KB
> fpu		: yes
> fpu_exception	: yes
> cpuid level	: 1
> wp		: yes
> flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
> pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow
> bogomips	: 3597.08
> TLB size	: 1024 4K pages
> clflush size	: 64
> cache_alignment	: 64
> address sizes	: 40 bits physical, 48 bits virtual
> power management: ts fid vid ttp
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466



More information about the R-devel mailing list