>    static const scm_t_bits my_false = 0x4;
>    static const scm_t_bits my_true = 0x404;
>    static const scm_t_bits my_nil = 0x104;
>    static const scm_t_bits my_eof = 0xa04;
>    static const scm_t_bits my_eol = 0x304;
>    static const scm_t_bits my_unspecified = 0x804;

I get slightly different values for 1.8 (32 bit x86), here
in Fortran syntax:

type, public, bind(c) :: scm_t
   private
   integer(c_intptr_t) :: ptr
end type scm_t

type(scm_t), public, parameter :: my_false       = scm_t (x'004')
type(scm_t), public, parameter :: my_true        = scm_t (x'104')
type(scm_t), public, parameter :: my_eof         = scm_t (x'304')
type(scm_t), public, parameter :: my_eol         = scm_t (x'404')
type(scm_t), public, parameter :: my_unspecified = scm_t (x'504')

Do I assume correctly that #nil does not exist in 1.8?

So at the moment when everybody migrates to 2.0 that would mean
an #ifdef/esle/endif with two sets of compile time constants.


So far I was able to avoid that. Though in this way one can make them true
compile-time "parameters". Are these numbers likely to change
between 32/64 bit architectures?

I used this slightly modified code to get those numbers:

(define (const-dump)
  (for-each
   (lambda (pair)
     (format #t "static const scm_t_bits my_~A = 0x~X;\n"
             (car pair)
             (object-address (cdr pair))))
   `(("false" . #f)
     ("true" . #t)
     ;; ("nil" . #nil)
     ("eof" . ,(with-input-from-string "" read))
     ("eol" . ())
     ("unspecified" . ,(if #f #f)))))

Alexei

Reply via email to