Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Ashish Agarwal" <agarwal1975@gmail.com>
To: "Caml Mailing List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Concatenation of static strings?
Date: Sat, 26 Jan 2008 08:27:47 -0500	[thread overview]
Message-ID: <d8be5ae20801260527u824cc8vbdbd6f7198f7f8ca@mail.gmail.com> (raw)
In-Reply-To: <6f9f8f4a0801250247w37d4c66q1b268e47a72ecabf@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1428 bytes --]

I submitted a bug report.


On Jan 25, 2008 5:47 AM, Loup Vaillant <loup.vaillant@gmail.com> wrote:

> 2008/1/25, Oliver Bandel <oliver@first.in-berlin.de>:
> > Zitat von Ashish Agarwal <agarwal1975@gmail.com>:
> >
> > > I was hoping there would be some follow up discussion on the code
> > > below, but
> > > haven't seen anything yet.
> > [...]
> >
> > [...]
> > It behaves like if s would be defined on top of the
> > module, but it is  local constructed in the function f.
> > Look sstrange... I have the same behaviour here (Debians
> > OCaml here is 3.09.2, and I have tried with toplevel, bytecode
> > and naticecode).
>
> Ouch: this is the same as in C: the attempt to modify a statically
> defined string makes bad things happen. One should try this on Open
> BSD: it may even crash, if the the data segment is protected from
> write. Replacing "abc" by String.copy "abc" works around this, though:
>
> # let f () = let s = String.copy "bla" in let c = s.[0] in s.[0] <- 'c' ;
> c ;;
> val f : unit -> char = <fun>
> # f();;
> - : char = 'b'
> # f();;
> - : char = 'b'
>
> Pure again :-)
>
> Cheers,
> Loup
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2379 bytes --]

  reply	other threads:[~2008-01-26 13:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-19  3:32 Erik de Castro Lopo
2008-01-19  6:50 ` [Caml-list] " David Allsopp
2008-01-19  7:36   ` Erik de Castro Lopo
2008-01-19 10:55 ` David Baelde
2008-01-24 23:02   ` Ashish Agarwal
2008-01-25  1:57     ` Oliver Bandel
2008-01-25 10:47       ` Loup Vaillant
2008-01-26 13:27         ` Ashish Agarwal [this message]
2008-01-26 16:13     ` Jon Harrop
2008-01-26 19:58       ` Oliver Bandel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8be5ae20801260527u824cc8vbdbd6f7198f7f8ca@mail.gmail.com \
    --to=agarwal1975@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox