[Rd] Problem with types on 64-bit
tom at levelelimited.com
tom at levelelimited.com
Tue Feb 20 15:59:51 CET 2007
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
More information about the R-devel
mailing list