Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread John Carter via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:43:17 UTC, ponce wrote: Additionally, I was said weeks ago on this NG that and signed overflow in D is not actually Undefined Behaviour. Interesting.. The reference is fairly terse on exactly what happens, is it more formally specified anywhere? In which c

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread anonymous via Digitalmars-d-learn
On Wednesday 02 September 2015 09:52, Uranuz wrote: > I want to understand if we have *save* method in Forward Range > then why or in which cases we should use plain struct copying > instead. Should we assume that these two ways are equal or not? No, don't assume that they're the same. > Also as

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 02, 2015 11:47:11 drug via Digitalmars-d-learn wrote: > On 02.09.2015 11:30, FreeSlave wrote: > >> I see, thanks. So I should always treat char[] as UTF in D itself, but > >> because I need to pass char[], wchar[] or dchar[] to a C library I > >> should treat it as not UTF b

Re: Casting away immutability

2015-09-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 02, 2015 14:00:07 Sergei Degtiarev via Digitalmars-d-learn wrote: > On Wednesday, 2 September 2015 at 04:19:24 UTC, lobo wrote: > > No, I think your design is unsafe because you're throwing away > > type information and returning void[], then telling the > > compiler not to

Re: 2.068.0 std.process.executeShell how to set the shell?

2015-09-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, September 02, 2015 15:28:35 albatroz via Digitalmars-d-learn wrote: > On Wednesday, 2 September 2015 at 01:46:18 UTC, Jonathan M Davis > wrote: > > On Wednesday, 2 September 2015 at 01:26:23 UTC, Jonathan M > > Davis wrote: > > [snip] > > > > https://issues.dlang.org/show_bug.cgi?id=

Re: interprocess communication and sharing memory

2015-09-02 Thread j55 via Digitalmars-d-learn
On Thursday, 3 September 2015 at 02:52:00 UTC, Laeeth Isharc wrote: On Thursday, 3 September 2015 at 01:27:15 UTC, j55 wrote: [...] It's probably a stupid idea, but until someone with experience answers: what happens if you declare the memory as shared or __gshared and send a pointer to it v

Re: interprocess communication and sharing memory

2015-09-02 Thread Laeeth Isharc via Digitalmars-d-learn
On Thursday, 3 September 2015 at 01:27:15 UTC, j55 wrote: This is my first attempt at a project in D, so pardon me if I'm overlooking something obvious: I'm using libasync to create an eventloop, to set up something like a server/daemon process. This part works very well. We'll call this Se

interprocess communication and sharing memory

2015-09-02 Thread j55 via Digitalmars-d-learn
This is my first attempt at a project in D, so pardon me if I'm overlooking something obvious: I'm using libasync to create an eventloop, to set up something like a server/daemon process. This part works very well. We'll call this Server A. Now I'd like to write another process (running on

Re: reading file byLine

2015-09-02 Thread wobbles via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:53:20 UTC, Namal wrote: Thx guys, this helped alot. The next thing I want to do is read the file line by line and split the stream into words. I found this example of code that seems to do sort of something like it. How can I modyfy it so I can store the wor

Re: reading file byLine

2015-09-02 Thread Namal via Digitalmars-d-learn
Thx guys, this helped alot. The next thing I want to do is read the file line by line and split the stream into words. I found this example of code that seems to do sort of something like it. How can I modyfy it so I can store the words in an array of strings? Is a => a.length the iterator rang

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread ponce via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 21:22:59 UTC, John Carter wrote: On Wednesday, 2 September 2015 at 11:03:00 UTC, ponce wrote: Everything Bjarne said still applies equally to D code, since integer promotion is identical with C from what I understand. Hmm. What Robert Elder says also applies

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread John Carter via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 11:03:00 UTC, ponce wrote: On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions Everything Bjarn

Re: reading file byLine

2015-09-02 Thread via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 15:04:10 UTC, cym13 wrote: You can also reset a variable to its initial state (what you would hav had if you hadn't initialized it) using: buffer.init(); Huh? That doesn't work... Instead, use: buffer = buffer.init;

Re: new static array

2015-09-02 Thread anonymous via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:04:40 UTC, Ali Çehreli wrote: > with int[4] it compiles and runs. int[][4] fails. Is this a bug? I think so. https://issues.dlang.org/show_bug.cgi?id=15004 may related to https://issues.dlang.org/show_bug.cgi?id=10740

Re: Access Violation while trying to use OpenGL

2015-09-02 Thread spec00 via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 01:07:01 UTC, Mike Parker wrote: On Tuesday, 1 September 2015 at 20:35:43 UTC, spec00 wrote: On Tuesday, 1 September 2015 at 20:15:28 UTC, spec00 wrote: [...] The problem was in me using the 64bit version of the GLFW dll. DMD doesn't support compiling to x64

Re: 2.068.0 std.process.executeShell how to set the shell?

2015-09-02 Thread albatroz via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 01:46:18 UTC, Jonathan M Davis wrote: On Wednesday, 2 September 2015 at 01:26:23 UTC, Jonathan M Davis wrote: [snip] https://issues.dlang.org/show_bug.cgi?id=15000 - Jonathan M Davis Thank you for your reply and for the bug report. Looking at your suggestio

Re: reading file byLine

2015-09-02 Thread cym13 via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 15:04:10 UTC, cym13 wrote: On Wednesday, 2 September 2015 at 13:46:54 UTC, Namal wrote: Thx, cym. I have a question about a D strings though. In c++ I would just reuse the string buffer with the "=" how can I clear the string after i store a line in the buffer

Re: reading file byLine

2015-09-02 Thread cym13 via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 13:46:54 UTC, Namal wrote: Thx, cym. I have a question about a D strings though. In c++ I would just reuse the string buffer with the "=" how can I clear the string after i store a line in the buffer and do something with it. I also tried to append a line to an

Re: reading file byLine

2015-09-02 Thread qznc via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 13:46:54 UTC, Namal wrote: On Wednesday, 2 September 2015 at 13:12:39 UTC, cym13 wrote: On Wednesday, 2 September 2015 at 13:01:31 UTC, Namal wrote: Hello, I want to read a file line by line and store each line in a string. I found this example with byLine an

Re: Casting away immutability

2015-09-02 Thread Sergei Degtiarev via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 04:19:24 UTC, lobo wrote: No, I think your design is unsafe because you're throwing away type information and returning void[], then telling the compiler not to worry about it. It is unsafe, but this not my design but std.mmfile module in phobos. This is what I

Re: reading file byLine

2015-09-02 Thread Namal via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 13:12:39 UTC, cym13 wrote: On Wednesday, 2 September 2015 at 13:01:31 UTC, Namal wrote: Hello, I want to read a file line by line and store each line in a string. I found this example with byLine and ranges. First of all, do I need the range lib at all to do

Re: Digger 2.3 & verstr.h problem

2015-09-02 Thread Robert M. Münch via Digitalmars-d-learn
Some more tests with a simple example: import std.stdio; void main() { writeln("hello world!" ~ import("signature.h")); } mac-pro:d-language robby$ dmd -v -J. hello.d binarydmd version v2.068.0 config/usr/local/bin/dmd.conf parse hello importall hello importobject(

Re: reading file byLine

2015-09-02 Thread cym13 via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 13:01:31 UTC, Namal wrote: Hello, I want to read a file line by line and store each line in a string. I found this example with byLine and ranges. First of all, do I need the range lib at all to do this and if so what is the range of the end of the file? Yo

reading file byLine

2015-09-02 Thread Namal via Digitalmars-d-learn
Hello, I want to read a file line by line and store each line in a string. I found this example with byLine and ranges. First of all, do I need the range lib at all to do this and if so what is the range of the end of the file?

Re: Digger 2.3 & verstr.h problem

2015-09-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-08-23 17:01:07 +, Vladimir Panteleev said: Can't reproduce this on Windows, Linux or OS X 10.10.3. Can you include more of the build log (specifically, the entire failing command line)? It should have a -J. in it. I still try to get digger running on my OSX again. I fiddled aroun

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread ponce via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions Everything Bjarne said still applies equally to D code, since integer promoti

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 09:47:16 UTC, BBasile wrote: On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions It depends on

Re: Prefer Signed or Unsigned in D?

2015-09-02 Thread BBasile via Digitalmars-d-learn
On Tuesday, 1 September 2015 at 23:06:50 UTC, John Carter wrote: C/C++ discussion here http://blog.robertelder.org/signed-or-unsigned-part-2/ D rules here... http://dlang.org/type.html#integer-promotions It depends on the context. You should take care of blending signed and unsign

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
my guess is that InitiatingPTrack.toString is not @safe

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread drug via Digitalmars-d-learn
On 02.09.2015 11:36, Robert burner Schadek wrote: On Wednesday, 2 September 2015 at 06:57:12 UTC, drug wrote: Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function 'std.experim

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-02 Thread drug via Digitalmars-d-learn
On 02.09.2015 11:30, FreeSlave wrote: I see, thanks. So I should always treat char[] as UTF in D itself, but because I need to pass char[], wchar[] or dchar[] to a C library I should treat it as not UTF but ubytes sequence or ushort or uint sequence - just to pass it correctly, right? You shoul

Re: std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread Robert burner Schadek via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:57:12 UTC, drug wrote: Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function 'std.experimental.logger.core.Logger.memLogFunctions!cast(Log

Re: Why ElementType!(char[3]) == dchar instead of char?

2015-09-02 Thread FreeSlave via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 05:00:42 UTC, drug wrote: 02.09.2015 00:08, Jonathan M Davis via Digitalmars-d-learn пишет: On Tuesday, September 01, 2015 20:05:18 drug via Digitalmars-d-learn wrote: My case is I don't know what type user will be using, because I write a library. What's the

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread Uranuz via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 07:34:15 UTC, Mike Parker wrote: On Wednesday, 2 September 2015 at 06:28:52 UTC, Uranuz wrote: As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without u

Re: Problem with using struct ranges with @disabled this(this) with some range functions

2015-09-02 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 2 September 2015 at 06:28:52 UTC, Uranuz wrote: As far as I understand to save current cursor of forward range I should always use *save* property. But sometimes range struct is just copied using postblit without using save (it happens even in Phobos). Is it correct behaviour to *

std.experimental.logger instantiation fails in 2.067

2015-09-02 Thread drug via Digitalmars-d-learn
Before 2.067 I used std.experimental.logger in form of a dub package. Because it included in 2.067 I stop using the dub package but now I get the error: Error: safe function 'std.experimental.logger.core.Logger.memLogFunctions!cast(LogLevel)cast(ubyte)32u.logImplf!(383, [snip]).logImplf' cannot