quick question: What is the most efficient way to covert a string
to a char array?
On Tuesday, 2 June 2015 at 15:26:50 UTC, Dennis Ritchie wrote:
On Tuesday, 2 June 2015 at 15:07:58 UTC, Kyoji Klyden wrote:
quick question: What is the most efficient way to covert a
string to a char array?
string s = "str";
char[] strArr = s.dup;
Thanks! :)
On Tuesday, 2 June 2015 at 15:53:33 UTC, Alex Parrill wrote:
On Tuesday, 2 June 2015 at 15:07:58 UTC, Kyoji Klyden wrote:
quick question: What is the most efficient way to covert a
string to a char array?
A string is, by definition in D, a character array,
specifically `immutable(char)[]`. It
On Tuesday, 2 June 2015 at 16:26:30 UTC, Alex Parrill wrote:
On Tuesday, 2 June 2015 at 16:23:26 UTC, Kyoji Klyden wrote:
On Tuesday, 2 June 2015 at 15:53:33 UTC, Alex Parrill wrote:
On Tuesday, 2 June 2015 at 15:07:58 UTC, Kyoji Klyden wrote:
quick question: What is the most efficient way to c
On Tuesday, 2 June 2015 at 17:03:32 UTC, Alex Parrill wrote:
On Tuesday, 2 June 2015 at 16:41:38 UTC, Kyoji Klyden wrote:
src:
string source = readText("test.glvert");
const string sources = source.toStringz;
const int len = source.length;
GLuin
On Wednesday, 3 June 2015 at 08:11:16 UTC, Kagamin wrote:
On Tuesday, 2 June 2015 at 16:41:38 UTC, Kyoji Klyden wrote:
src:
string source = readText("test.glvert");
const string sources = source.toStringz;
const int len = source.length;
GLuint ve
On Wednesday, 3 June 2015 at 10:28:50 UTC, Marc Schütz wrote:
A string (or any other array slice for that matter) is
internally the equivalent of:
struct Slice(T) {
T* ptr;
size_t length;
}
(maybe the order of fields is different, I never remember that
part)
`&sour
Ooooh okay, I'm starting to get it. I think this last question
should clear it up for me: When a string is made, how is the
struct Slice handled? What does ptr get assigned?
On Wednesday, 3 June 2015 at 11:28:14 UTC, anonymous wrote:
On Wednesday, 3 June 2015 at 11:23:09 UTC, Kyoji Klyden wrote:
Ooooh okay, I'm starting to get it. I think this last question
should clear it up for me: When a string is made, how is the
struct Slice handled? What does ptr get assigned
On Wednesday, 3 June 2015 at 11:46:25 UTC, Kagamin wrote:
On Wednesday, 3 June 2015 at 10:21:20 UTC, Kyoji Klyden wrote:
Also the one part I don't understand is with &sources. So is
this passing sources as a reference, but sources itself is a
pointer to a pointer? I'm just a tad confused on how
On Thursday, 4 June 2015 at 03:25:24 UTC, ketmar wrote:
On Wed, 03 Jun 2015 11:59:56 +, Kyoji Klyden wrote:
That's what I found so confusing about the opengl docs. Just
guessing
here but char* is a pointer to the first char in the string,
then what
exactly is char**? Is it pointing to the
On Thursday, 4 June 2015 at 22:28:50 UTC, anonymous wrote:
Generally, a `char**` is a pointer to a pointer to a char.
There may be more pointers to chars behind the pointed-to one.
And there may be more chars behind the pointed-to ones. You
can't know just from the type. You have to read the
On Friday, 5 June 2015 at 18:06:25 UTC, Kagamin wrote:
On Friday, 5 June 2015 at 17:27:18 UTC, Kyoji Klyden wrote:
Does the slice's pointer point to the slice's position in
memory? Then if an array isn't sequential, is it atleast a
sequence of pointers to the slice structs (& those are just in
On Friday, 5 June 2015 at 18:30:53 UTC, Kagamin wrote:
Well, reading assembler is good enough:
void f(int[] a)
{
a[0]=0;
a[1]=1;
a[2]=2;
}
Here pointer is passed in rsi register and length - in rdi:
void f(int[]):
pushrax
testrdi, rdi
je .LBB0_4
On Friday, 5 June 2015 at 19:18:39 UTC, anonymous wrote:
On Friday, 5 June 2015 at 17:27:18 UTC, Kyoji Klyden wrote:
On Thursday, 4 June 2015 at 22:28:50 UTC, anonymous wrote:
[...]
By the way, there are subtly different meanings of "array"
and "string" which I hope you're aware of, but just t
On Friday, 5 June 2015 at 19:41:03 UTC, anonymous wrote:
On Friday, 5 June 2015 at 19:30:58 UTC, Kyoji Klyden wrote:
Okay, so it's primarily an interfacing with C problem that
started all this? (My brain is just completely scrambled at
this point xP )
Yeah, you wanted to call glShaderSource,
On Saturday, 6 June 2015 at 10:12:54 UTC, Marc Schütz wrote:
...
Almost correct :-) The part of "has nothing left, so go back"
is wrong. The call to _d_arraybounds doesn't return, because it
throws an Error.
...
Yes, inside the `f` function, the compiler cannot know the
length of the ar
On Saturday, 6 June 2015 at 18:43:08 UTC, Marc Schütz wrote:
_d_arraybounds() always throws an error because that's its
purpose. It's implemented here:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L640
My point was that _d_arraybounds never returns, inst
On Monday, 8 June 2015 at 09:54:28 UTC, Kagamin wrote:
On Sunday, 7 June 2015 at 17:41:11 UTC, Kyoji Klyden wrote:
Do you perchance have any links to learning resources for the
D runtime(aside from just the github repository), and also
maybe x86 architecture stuff? (I know intel has some 1000+
On Tuesday, 9 June 2015 at 00:22:09 UTC, Timothee Cour wrote:
On Mon, Jun 8, 2015 at 12:08 AM, Adam D. Ruppe via
Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
The easiest way is to not use search paths, and instead pass
all the
modules you want compiled to the compiler direct
How would I use a C function that's returning a struct? auto
doesn't work here, and from what I can tell D can't import C
headers. (If it really can't then, that would be a very welcome
feature)
I do have the required libs but I can't create my D obj file so I
can't really get there.
I know
Thanks for the replies,
This issue really highlights one of D's weak points I think.
I've atleast got a round about solution almost working. :P
On Thursday, 30 July 2015 at 11:32:10 UTC, bachmeier wrote:
On Thursday, 30 July 2015 at 01:14:06 UTC, Mike Parker wrote:
On Wednesday, 29 July 2015 at 18:42:45 UTC, Kyoji Klyden wrote:
Thanks for the replies,
This issue really highlights one of D's weak points I think.
I've atleast got a rou
On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote:
On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote:
So idk, it feels silly and counterproductive to have D not
able to natively use C libraries. Are we just gonna have to
write D bindings to every notable library out there? Also
On Friday, 31 July 2015 at 19:13:18 UTC, Laeeth Isharc wrote:
On Friday, 31 July 2015 at 17:14:29 UTC, Kyoji Klyden wrote:
On Friday, 31 July 2015 at 16:09:23 UTC, bachmeier wrote:
On Friday, 31 July 2015 at 03:30:20 UTC, Kyoji Klyden wrote:
So idk, it feels silly and counterproductive to have
On Saturday, 1 August 2015 at 04:11:02 UTC, Laeeth Isharc wrote:
Walter observes that if you are a Java programmer and start
writing D, you will write D like you write Java. And so I
suppose one will see what one doesn't have in Java, but not so
much the benefits of D. That's true of other la
26 matches
Mail list logo