Re: What does scope do as storage class?

2017-12-23 Thread Nemanja Boric via Digitalmars-d-learn
On Saturday, 23 December 2017 at 21:20:13 UTC, Jonathan M Davis wrote: On Saturday, December 23, 2017 21:05:25 Marc via Digitalmars-d-learn wrote: for example: scope struct S { int x; } What does scope do here? Absolutely nothing.

Re: High-level wrapper for readline package

2017-09-07 Thread Nemanja Boric via Digitalmars-d-learn
On Thursday, 7 September 2017 at 14:00:36 UTC, Nordlöw wrote: On Thursday, 7 September 2017 at 13:44:52 UTC, Adam D. Ruppe wrote: [...] There's always room for usability improvements when wrapping C APIs... [...] Minor point: you should add_history only if `lineStringz && lineStringz[0]

Re: How do I create a fileWatcher with an onFileChange event using spawn?

2017-08-28 Thread Nemanja Boric via Digitalmars-d-learn
On Monday, 28 August 2017 at 06:27:20 UTC, Jacob Carlborg wrote: On 2017-08-25 23:25, Enjoys Math wrote: Something like this: module file_watcher; import std.concurrency; import std.file; import std.signals; import std.datetime; void fileWatcher(Tid tid, string filename, int loopSleep) {

Re: libc dependency

2017-06-20 Thread Nemanja Boric via Digitalmars-d-learn
On Tuesday, 20 June 2017 at 11:18:17 UTC, Nemanja Boric wrote: Phobos (_not_ druntime) uses C _standard library_ abstractions for many things I just took a quick look and it seems that I'm remembering this wrong.

Re: libc dependency

2017-06-20 Thread Nemanja Boric via Digitalmars-d-learn
On Tuesday, 20 June 2017 at 11:08:15 UTC, Moritz Maxeiner wrote: On Tuesday, 20 June 2017 at 11:00:00 UTC, Nemanja Boric wrote: On Monday, 19 June 2017 at 21:45:56 UTC, Moritz Maxeiner wrote: On Monday, 19 June 2017 at 21:35:56 UTC, Steven Schveighoffer wrote: IIRC, Tango did not depend on

Re: libc dependency

2017-06-20 Thread Nemanja Boric via Digitalmars-d-learn
On Monday, 19 June 2017 at 21:45:56 UTC, Moritz Maxeiner wrote: On Monday, 19 June 2017 at 21:35:56 UTC, Steven Schveighoffer wrote: IIRC, Tango did not depend on libc at all. It only used system calls. So it certainly is possible. How did they invoke those system calls? They are usually

Re: Array start index

2017-02-06 Thread Nemanja Boric via Digitalmars-d-learn
On Monday, 6 February 2017 at 18:55:19 UTC, pineapple wrote: One reason for zero-based indexes that isn't "it's what we're all used to" is that if you used one-based indexes, you would be able to represent one fewer index than zero-based, since one of the representable values - zero - could no

Re: Making .exe

2017-01-19 Thread Nemanja Boric via Digitalmars-d-learn
On Thursday, 19 January 2017 at 18:58:31 UTC, Dlearner wrote: Hey! I wrote a little program that has an image bounce around and change colours, like the old DVD player screensavers. How can I build this as a little .exe file that I can send to someone? In the dub documentation there is

Re: What do you use to generate documentation?

2017-01-19 Thread Nemanja Boric via Digitalmars-d-learn
On Thursday, 19 January 2017 at 16:47:07 UTC, Basile B. wrote: On Wednesday, 13 March 2013 at 09:35:18 UTC, Andrea Fontana wrote: [...] I use harbored-mod (https://github.com/kiith-sa/hmod-dub). What I like about it: 1/ I'm not good with web things. The default styling is Okay for me so I

Re: Explain the Modules to me but better...

2016-12-29 Thread Nemanja Boric via Digitalmars-d-learn
On Thursday, 29 December 2016 at 19:00:25 UTC, Nemanja Boric wrote: On Thursday, 29 December 2016 at 18:20:22 UTC, Modules Confuse Me wrote: [...] If you have following: [...] This all is valid, of course, only if I guessed right your problem :-)

Re: Explain the Modules to me but better...

2016-12-29 Thread Nemanja Boric via Digitalmars-d-learn
On Thursday, 29 December 2016 at 18:20:22 UTC, Modules Confuse Me wrote: I'm trying to get going with D, but I keep getting hung up on modules. I personally like having many smaller files. Generally classes and interfaces all go into their own file. Even if the overall file ends up being

Re: Best way to clear dynamic array for reuse

2016-12-28 Thread Nemanja Boric via Digitalmars-d-learn
On Wednesday, 28 December 2016 at 12:30:33 UTC, Michael Rynn wrote: It takes a bit of work to get around the mutable buffers problem in D language arrays. I found it made a performance difference in xml parsing. https://github.com/betrixed/dlang-xml/blob/master/xml/util/buffer.d /**

Re: understanding std.algorithm.mutation.fill behaivor.

2016-12-28 Thread Nemanja Boric via Digitalmars-d-learn
On Wednesday, 28 December 2016 at 05:09:34 UTC, LeqxLeqx wrote: Perhaps this is a stupid question, and I apologize if it is, but why doesn't this compile: import std.algorithm; import std.stdio; void main() { char[] array = [1, 2, 3, 4]; char value = 2;

Re: How to detect free/unfree memory segments?

2016-12-23 Thread Nemanja Boric via Digitalmars-d-learn
I can just partially answer this part of the question: Could anybody explain what dangerous of memory fragmentation in languages without GC? Am I right understand that there is stay some small memory chunks that very hard to reuse? On Unix-like systems, system call for allocating memory is

Re: Poll

2016-12-23 Thread Nemanja Boric via Digitalmars-d-learn
What's in the `core.sys.posix.poll` is just a C wrapper, meaning if you use functions declared there, you're just calling the same one you would do in C, so it's very likely that you're doing something different in D and C program. Here's the example that works for me: ``` void main() {

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-29 Thread Nemanja Boric via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:30:33 UTC, Anders S wrote: Hi guys, I want to write into a fifo pipe using write( ...) Now a gather my data into my own struct IOREQ so in order to write I have to cast into an char buffer. My problem in dlang is that it doesn't accept the casting (IOREQ

Re: Cannot implicitly convert expression () of type char [1024] to IOREQ *

2016-11-29 Thread Nemanja Boric via Digitalmars-d-learn
On Tuesday, 29 November 2016 at 15:55:57 UTC, Nemanja Boric wrote: just struct IOREQ { SHORT fc; /* function code */ SHORT rs; /* return code */ INT size; /* size of this request, including */

Re: not callable error

2016-11-04 Thread Nemanja Boric via Digitalmars-d-learn
On Friday, 4 November 2016 at 14:37:04 UTC, bluphantom91 wrote: On Friday, 4 November 2016 at 02:59:49 UTC, Paul Backus wrote: On Friday, 4 November 2016 at 02:28:17 UTC, bluphantom91 wrote: Hello, I am trying to finish up a group project but I am running into a small problem. I keep getting

Re: Proper way to work around `Invalid memory operation`?

2016-09-26 Thread Nemanja Boric via Digitalmars-d-learn
On Sunday, 25 September 2016 at 16:07:12 UTC, Matthias Klumpp wrote: At time, I work around this bug by calling close() manually at the appropriate time, but this feel like a rather poor solution. Cheers, Matthias That's not a poor solution, but rather a much better solution if you rely