[gambit-list] print vs. display segfault

Christian Jaeger christian at pflanze.mine.nu
Thu Apr 26 08:45:02 EDT 2007


Lang Martin wrote:

> ok, I got a segfault in a program and I don't quite understand the  
> cause.

Your code is using %string-charset->pred which you don't specify in your mail.


You could run Gambit under gdb. This usually gives hints.


BTW are you using (declare (not safe)) ?


I think print 


(define-prim (print

              #!key (port (macro-absent-obj))

              #!rest body)

  (macro-force-vars (port)

    (let ((p

           (if (##eq? port (macro-absent-obj))

             (macro-current-output-port)

             port)))

      (macro-check-output-port p 2 (print port: p . body)

        (##display body p)))))


whereas


(define-prim (##display obj port #!optional (max-length ##max-fixnum))

  (if (macro-character-output-port? port)

    (begin

      (##write-generic-to-character-port

       'display

       port

       (macro-character-port-output-readtable port)

       (macro-if-forces #t #f)

       max-length

       obj)

      (##void))

    ((macro-port-write-datum port) port obj #f)))


so I don't really see why choosing one over the other should matter.


Christian.





More information about the Gambit-list mailing list