Re: How to detect free/unfree memory segments?

2016-12-23 Thread Suliman via Digitalmars-d-learn
On Saturday, 24 December 2016 at 01:15:43 UTC, jkpl wrote: On Friday, 23 December 2016 at 06:18:02 UTC, Suliman wrote: I would like to visualize how GC works and display free/not free memory segments. How I can understand which of them are used and which not? Could anybody explain what

Re: How to detect free/unfree memory segments?

2016-12-23 Thread jkpl via Digitalmars-d-learn
On Friday, 23 December 2016 at 06:18:02 UTC, Suliman wrote: I would like to visualize how GC works and display free/not free memory segments. How I can understand which of them are used and which not? Could anybody explain what dangerous of memory fragmentation in languages without GC? Am I

Re: How to initialize a associative array?

2016-12-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 24 December 2016 at 00:57:04 UTC, Yuxuan Shui wrote: On Saturday, 24 December 2016 at 00:55:01 UTC, Yuxuan Shui wrote: I tried this: immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3, 'P':4]; And got a "non-constant expression" error (with or without 'immutable').

How to initialize a associative array?

2016-12-23 Thread Yuxuan Shui via Digitalmars-d-learn
I tried this: immutable int[char] xx = ['Q':0, 'B':1, 'N':2, 'R':3, 'P':4]; And got a "non-constant expression" error (with or without 'immutable'). What's the correct way?

Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.

2016-12-23 Thread hardreset via Digitalmars-d-learn
On Saturday, 17 December 2016 at 04:58:45 UTC, Mike Parker wrote: On Friday, 16 December 2016 at 22:37:13 UTC, hardreset wrote: To be honest I was having some odd linking problems anyway. I initially wrapped the FT init function in plain D function and that kept causing "_FT_ not found"

Re: Poll

2016-12-23 Thread LeqxLeqx via Digitalmars-d-learn
On Friday, 23 December 2016 at 12:51:29 UTC, Nemanja Boric wrote: 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

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() {

Poll

2016-12-23 Thread LeqxLeqx via Digitalmars-d-learn
I've recently been attempting to detect whether or not stdin would block a read if I tried. I have attempted to use the /core/sys/posix/poll.d but that seems to be always returning '1' whether or not stdin has anything on it, whereas for the corresponding program written in C, it will return 1