Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
June 01, 2013 loadLibrary string | ||||
---|---|---|---|---|
| ||||
In the talk "Shared Libraries in D by Martin Nowak" loadLibrary is presented with the signature: void* loadLibrary(string path); But in the docs we have: static void* loadLibrary(in char[] name); Any particular reason for using "in char[]" instead of string? (I suppose the "in" makes the string head constant, but not the string body.) Path also seems slightly more explicit than "name", so consider that if someone wants to change it. |
June 01, 2013 Re: loadLibrary string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On Saturday, 1 June 2013 at 20:01:18 UTC, Luís Marques wrote:
> Any particular reason for using "in char[]" instead of string? (I suppose the "in" makes the string head constant, but not the string body.)
There is no head const in D.
— David
|
June 01, 2013 Re: loadLibrary string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | Either Google is buggy or there may be something wrong with the times presented by the forum. I was searching for loadLibrary and found my own post: loadLibrary string - D Programming Language Discussion forum.dlang.org/post/xtkqpnortzookwvryzlv@forum.dlang.org 13 hours ago - 1 post This wasn't 13 hours ago. Is there some timestamp that may be lacking the correct timezone information, or something like that, that could help Google correctly deduce the time? |
June 01, 2013 Re: loadLibrary string | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On Saturday, 1 June 2013 at 20:20:14 UTC, David Nadlinger wrote:
> There is no head const in D.
So is having an "in char[]" the same as having an immutable(char)[] / string?
|
June 01, 2013 Re: loadLibrary string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On Saturday, 1 June 2013 at 20:23:23 UTC, Luís Marques wrote:
> So is having an "in char[]" the same as having an immutable(char)[] / string?
Almost. in basically means const, so it can take strings or char[].
void foo(string s);
void foo2(in char s);
char[] a;
string b;
foo(a); // not allowed
foo(b); // allowed
foo2(a); // allowed
foo2(b); // also allowed
|
June 01, 2013 Re: loadLibrary string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On Saturday, June 01, 2013 22:23:22 =?UTF-8?B?Ikx1w61z?=.Marques <luismarques@gmail.com>@puremagic.com wrote: > On Saturday, 1 June 2013 at 20:20:14 UTC, David Nadlinger wrote: > > There is no head const in D. > > So is having an "in char[]" the same as having an > immutable(char)[] / string? "in char" is equivalent to "scope const char[]". The scope does not currently have any effect, but by having const char[], char[], const(char)[], and immutable(char)[] can all be passed to the loadLibrary, whereas if it accepted string, then only immutable(char)[] could be passed to it. - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation