bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: null string oddities


From: Neil Jerram
Subject: Re: null string oddities
Date: Sat, 20 Sep 2008 01:20:27 +0200

2008/9/19 Bill Schottstaedt <address@hidden>:
> I thought it odd that:
>
> guile> (string-length "")
> 0
> guile> (string-ref "" 3)
> #\nul
>
> but:
>
> guile> (string-set! "" 123 #\a)
> guile> (string-ref "" 123)
> #\a

Those _do_ look dangerous.  I'll take a look...

> guile> (substring "" 123 124)
>
> Backtrace:
> In standard input:
>   6: 0* [substring "" {123} 124]
>
> standard input:6:1: In procedure substring in expression (substring "" 123 
> ...):
> standard input:6:1: Value out of range 0 to 0: 123
> ABORT: (out-of-range)

At last, some bounds checking, hooray!

    Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]