Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Concatenation of static strings?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Concatenation of static strings?
On Thursday 24 January 2008 23:02:48 Ashish Agarwal wrote:
> I was hoping there would be some follow up discussion on the code below,
> but haven't seen anything yet. Can someone please clarify why this is not
> considered a bug (or is it).

This is not considered a bug. String literals are static but array literals 
are not.

> Given that s is locally scoped within f, I do not see why f returns
> different answers. 

A static local remains the same between calls (so it is not thread-safe).

This has been discussed before several times. The reason given more making 
strings static is performance.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.