"immutable string" vs "const string*"

2018-09-09 Thread Christian Mayer via Digitalmars-d-learn
In regard of performance, why should I rather use "immutable string" over "const string*" (or just "string*")? For example, as a function argument. When I have a loop which calls a function with a string argument. (And to avoid function inling in this example the function call is also used in

Re: "immutable string" vs "const string*"

2018-09-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/09/2018 8:09 PM, Christian Mayer wrote: In regard of performance, why should I rather use "immutable string" over "const string*" (or just "string*")? For example, as a function argument. When I have a loop which calls a function with a string argument. (And to avoid function inling in t

Re: "immutable string" vs "const string*"

2018-09-09 Thread Christian Mayer via Digitalmars-d-learn
On Sunday, 9 September 2018 at 08:14:41 UTC, rikki cattermole wrote: Are you aware that a string is just an alias of immutable(char)[]? Yes, I'm aware of that. But it's the same, for example, with just one char. "immutable char" vs "const char*". Or int, or any other data type. As of my cu

Re: "immutable string" vs "const string*"

2018-09-09 Thread rikki cattermole via Digitalmars-d-learn
On 09/09/2018 8:41 PM, Christian Mayer wrote: On Sunday, 9 September 2018 at 08:14:41 UTC, rikki cattermole wrote: Are you aware that a string is just an alias of immutable(char)[]? Yes, I'm aware of that. But it's the same, for example, with just one char. "immutable char" vs "const char*".

Re: "immutable string" vs "const string*"

2018-09-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 9, 2018 2:49:56 AM MDT rikki cattermole via Digitalmars-d-learn wrote: > On 09/09/2018 8:41 PM, Christian Mayer wrote: > > On Sunday, 9 September 2018 at 08:14:41 UTC, rikki cattermole wrote: > >> Are you aware that a string is just an alias of immutable(char)[]? > > > > Yes,

Re: "immutable string" vs "const string*"

2018-09-09 Thread Dennis via Digitalmars-d-learn
On Sunday, 9 September 2018 at 08:41:37 UTC, Christian Mayer wrote: As of my current understanding "char" will create a new variable and copy the content of the original to the new variable. "char*" will just use the pointer. And "const char*" is good for when not modifying. But I also can achi

Re: Bug with writeln?

2018-09-09 Thread Saurabh Das via Digitalmars-d-learn
Thank you for explaining all this. It is frustrating because the behaviour is very counterintuitive. I will use a workaround for now. Saurabh

Re: GTKD for android?

2018-09-09 Thread James via Digitalmars-d-learn
On Saturday, 8 September 2018 at 02:59:48 UTC, Josphe Brigmo wrote: I have an app I'm writing using GtkD on windows. Eventually I'd like to port it to android. Since I have never been able to actually get anything to work on android I'm curious if there are any demos with gtkD for android? I'm

Re: [vibe-d/dub] Lin

2018-09-09 Thread Martin Tschierschke via Digitalmars-d-learn
On Friday, 7 September 2018 at 16:37:18 UTC, MamoKupe wrote: On Friday, 7 September 2018 at 16:20:40 UTC, MamoKupe wrote: marcinan@marcinan-PC ~/Pulpit/d $ dub init bibe Package recipe format (sdl/json) [json]: d Invalid format, "d", enter either "sdl" or "json". Package recipe format (sdl/json)