On Nov 17, 2005, at 11:49 AM, Nitin Madnani wrote:
Hi Guys
Here's a piece of code that works fine under perl 5.8.5 on a 32-bit
linux machine but gives me errors on a 64-bit linux machine running
perl 5.8.6:
[snip]
// Use the current value of right_threshold as the key and store a new
hash there
hv_store(BLEU_CHANGE, right_threshold_str, right_threshold_str_len,
newRV_noinc((SV*)BLEU_CHANGE_rt = newHV()), 0);
// create a new array and store it with key "CORRECT" in
BLEU_CHANGE_rt
hv_store(BLEU_CHANGE_rt, "CORRECT", 7,
newRV_noinc((SV*)BLEU_CHANGE_rt_correct = newAV()), 0);
// do the same for the key "TOTAL"
hv_store(BLEU_CHANGE_rt, "TOTAL", 5,
newRV_noinc((SV*)BLEU_CHANGE_rt_total = newAV()), 0);
[/snip]
Here are the errors I get:
mert_perl_0877.xs:158: error: invalid lvalue in assignment
mert_perl_0877.xs:161: error: invalid lvalue in assignment
mert_perl_0877.xs:164: error: invalid lvalue in assignment
Is it talking about the assignment that I am doing inside the
newRV_noinc ?
Probably. Try changing parentheses to:
(SV*)(BLEU_CHANGE_rt_total = newAV())
so that the cast applies to the result of the assignment, not to the
lvalue.
-Ken