On 2024-02-10 15:38, Peter Bex wrote:

That's because you're using fixnum mode.  As I explained, using literals
that might be too large for fixnums break the fixnum mode's premise that
everything must be a fixnum.

Oh. So it refuses to emit C code that might break on 32-bit at runtime (silent truncation of atoi result, presumably), preferring instead to definitely break during Scheme compilation on any platform. OK, I get the rationale.


That's because string->number gets constant-folded and evaluated at
compile-time.


Obviously; and I suppose there's no simple way to prevent that for just one line, not the entire unit?

It would help if you tried to explain exactly _what_ you're trying to do
here, instead of _how_ you're trying to do it.  Why do you need these
constants?

I did mention twice that I'm using them to implement int->u32. There are also places where I need to increment-and-wrap int32's by INT32_MIN. I'm writing a Forth compiler incidentally (which may or may not have been a good idea). I store values in s32vector's, but they get turned into Scheme numbers by s32vector-ref. I guess I'd prefer native s32int/u32int types, complete with wrap-around and meaningful conversion to Scheme ints, but I don't think that exists.

It does that (more or less), as I explained. And it *wouldn't* work,


Yeah, I understand why now. I suppose the best way is to use foreign values. Maybe I should switch the arithmetic code to C too. Thanks.


-- Al

Reply via email to