Re: Weird array setting behaviour on Windows(-m64)

2016-04-13 Thread ref2401 via Digitalmars-d-learn
On Wednesday, 13 April 2016 at 15:07:09 UTC, rikki cattermole wrote: Verified that it is a codegen problem for Win64 and not *nix. Please file a bug report. https://issues.dlang.org/show_bug.cgi?id=15921 Done, Thanks

Weird array setting behaviour on Windows(-m64)

2016-04-13 Thread ref2401 via Digitalmars-d-learn
Hello, I got stuck with a weird array setting behaviour and I need help. Just have a look at the example. OS: Win 8.1 Pro DMD: v2.071.0 Build-cmd: dmd main.d -ofconsole-app.exe -debug -unittest -g -wi -m64 module dmain; import std.stdio; struct Vec { float a; } void main(string[]

Re: Error: template instance does not match template declaration

2016-03-30 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 18:29:27 UTC, Ali Çehreli wrote: So, dict is a template value parameter of type T[string]. I don't think you can use an associative array as a template value parameter. (Can we?) Found this in D language reference:

Re: Error: template instance does not match template declaration

2016-03-29 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 29 March 2016 at 18:29:27 UTC, Ali Çehreli wrote: On 03/29/2016 11:21 AM, ref2401 wrote: So, dict is a template value parameter of type T[string]. I don't think you can use an associative array as a template value parameter. (Can we?) However, it is possible to use anything as

Error: template instance does not match template declaration

2016-03-29 Thread ref2401 via Digitalmars-d-learn
OS: Win 8.1 Pro DMD: v2.070.0 cmd: dmd main.d -ofconsole-app.exe -debug -unittest -wi Code is successfully compiled until I uncomment test1 function call in the main. If it's uncommented I get the following compile-time error: main.d(58): Error: template instance impl!(string, bool,

pass a struct by value/ref and size of the struct

2016-03-21 Thread ref2401 via Digitalmars-d-learn
I have got a plenty of structs in my project. Their size varies from 12 bytes to 128 bytes. Is there a rule of thumb that states which structs I pass by value and which I should pass by reference due to their size? Thanks.

Re: Link error 42 (WinApi)

2016-02-15 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 06:22:33 UTC, Rikki Cattermole wrote: Found the problem, you haven't linked against gdi. Thank you It works. I should have done this: set filesToUse=main.d gdi32.lib dmd @filesToUse -ofconsole-app.exe -debug -unittest -wi

Re: Link error 42 (WinApi)

2016-02-15 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 16 February 2016 at 05:39:26 UTC, Rikki Cattermole wrote: Try compiling with 64bit. If it works, its just the import libs not containing the symbol. dmd main.d -ofconsole-app.exe -debug -unittest -wi -m64 That's what I'm getting now: console-app.obj : error LNK2019: unresolved

Re: Region allocator strage error

2016-02-01 Thread ref2401 via Digitalmars-d-learn
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote: I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure At least tell me can anyone replicate it?

Region allocator strage error

2016-01-31 Thread ref2401 via Digitalmars-d-learn
I am getting runtime error: core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure if LEN equals to 3, 5, 7, 9, ... void main(string[] args) { ubyte[1024] memory; auto stackAlloc = Region!NullAllocator(memory); IAllocator

InSituRegion + allocatorObject compile time error

2016-01-29 Thread ref2401 via Digitalmars-d-learn
Getting this error, could someone explain why? void main(string[] args) { InSituRegion!(1024) stackAlloc; IAllocator alloc = allocatorObject(stackAlloc); } ..\src\phobos\std\conv.d(5055): Error: static assert "Don't know how to initialize an object of type

Re: Make function nothrow

2016-01-28 Thread ref2401 via Digitalmars-d-learn
On Thursday, 28 January 2016 at 16:22:23 UTC, Ali Çehreli wrote: There is assumeWontThrow which terminates if an exception is indeed thrown: http://dlang.org/library/std/exception/assume_wont_throw.html Ali nice one, thx

Re: std.experimental.yesnogc

2016-01-14 Thread ref2401 via Digitalmars-d
On Thursday, 14 January 2016 at 02:13:20 UTC, Ilya wrote: std.memory --Ilya That's a good one.

Re: Wishlist for D

2015-12-16 Thread ref2401 via Digitalmars-d
On Tuesday, 1 December 2015 at 16:48:00 UTC, Suliman wrote: Right place is write here My wish: New `std.io` package that includes `std.file`, `std.path` and `std.stdio` modules.

static array crashes my program

2015-12-05 Thread ref2401 via Digitalmars-d-learn
I want to create a static array large enough to store 1MB of float values. What am I doing wrong? Here is a sample code with notes: void main(string[] args) { enum size_t COUNT = 1024 * 512 / float.sizeof; // works OK :) //enum size_t COUNT = 1024 * 512 * 2 / float.sizeof; //

Which type it better to use for array's indices?

2015-12-04 Thread ref2401 via Digitalmars-d-learn
Which type it better to use for array's indices? float[] arr = new float[10]; int i; long j; size_t k; // which one is better arr[i], a[j]or arr[k] ? It seem like `size_t` suites well because 'is large enough to represent an offset into all addressible memory.'

Re: Complexity nomenclature

2015-12-04 Thread ref2401 via Digitalmars-d
On Friday, 4 December 2015 at 16:06:25 UTC, Andrei Alexandrescu wrote: Well look at what the cat dragged in: http://dpaste.dzfl.pl/711aecacc450 That's quite promising. The code is very preliminary and uses strings for typical complexity values (e.g. "constant", "linear", and later

having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
It seems like `std.algorithm.each` is not executed in the example below. Could anyone tell why? Thank you. import std.algorithm; void main(string[] args) { int[] arr = [1, 2, 3, 4, 5]; arr.each!((ref e) => { writeln(e); // does not print ++e;

Re: having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
DMD 2.069.1 OS Win8.1 Enterprise

Re: having problem with `std.algorithm.each`

2015-11-30 Thread ref2401 via Digitalmars-d-learn
On Monday, 30 November 2015 at 12:03:08 UTC, anonymous wrote: On 30.11.2015 11:50, visitor wrote: though i don"t understand why it fails silently ?? ref2491's original code is valid, but doesn't have the intended meaning. `e => {foo(e);}` is the same as `(e) {return () {foo(e);};}`, i.e. a

Re: std.experimental.allocator optlink error

2015-11-10 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 08:48:37 UTC, ref2401 wrote: On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? How can I do that? When you setup dmd 2.069, did

Re: std.experimental.allocator optlink error

2015-11-10 Thread ref2401 via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 01:04:16 UTC, uiop wrote: Can you find the sources in your setup ? Any chance that that phobos.lib is still the the one distributed with dmd 2.068 ? How can I do that? When you setup dmd 2.069, did you use the 7z or installer ? Installer always btw. Thanks

std.experimental.allocator optlink error

2015-11-09 Thread ref2401 via Digitalmars-d-learn
Hello I wrote a small hello world app and imported the `std.experimental.allocator` module. I'm getting the following optlink error: --- OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved.

Re: std.experimental.allocator optlink error

2015-11-09 Thread ref2401 via Digitalmars-d-learn
On Monday, 9 November 2015 at 14:42:01 UTC, ref2401 wrote: Hello I wrote a small hello world app and imported the `std.experimental.allocator` module. I'm getting the following optlink error: --- OPTLINK (R) for Win32 Release 8.00.17 Copyright

Re: Allocation strategies question

2015-11-01 Thread ref2401 via Digitalmars-d-learn
On Friday, 30 October 2015 at 05:21:17 UTC, Rikki Cattermole wrote: What I normally do for memory to be owned by the thread is: auto foo(IAllocator alloc=theAllocator()) {...} Where as for if it is global to the process: auto foo(IAllocator alloc=processAllocator()) {...} Basically it is the

Re: good reasons not to use D?

2015-10-30 Thread ref2401 via Digitalmars-d-learn
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc wrote: I'm writing a talk for codemesh on the use of D in finance. I want to start by addressing the good reasons not to use D. (We all know what the bad ones are). I don't want to get into a discussion here on them, but just wanted

Allocation strategies question

2015-10-29 Thread ref2401 via Digitalmars-d-learn
As I understand the `std.experimental.allocator` package will be included in the upcoming DMD 2.069 release. I like the idea of composable allocators. Though I've got a question which I can not answer myself. Let's assume a team which is developing an application that can benefit from usage

Re: Allocation strategies question

2015-10-29 Thread ref2401 via Digitalmars-d-learn
On Friday, 30 October 2015 at 01:26:17 UTC, Rikki Cattermole wrote: Take a look at the functions theAllocator and processAllocator. It would be greate if compiler were able to use `theAllocator` and `processAllocator` but they don't seem much helpfull. Terrible naming by the way.

Re: Allocation strategies question

2015-10-29 Thread ref2401 via Digitalmars-d-learn
On Friday, 30 October 2015 at 04:11:05 UTC, ref2401 wrote: It would be greate if compiler were able to use `theAllocator` and `processAllocator` but they don't seem much helpfull. Terrible naming by the way. I should have suggested different names if don't like present ones. if

final class & final methods

2015-09-25 Thread ref2401 via Digitalmars-d-learn
If I declare a class as `final` do I have to mark all methods of the class as `final` too?

Re: Moving back to .NET

2015-09-22 Thread ref2401 via Digitalmars-d
On Tuesday, 22 September 2015 at 13:38:33 UTC, Chris wrote: it's only from D that users expect perfection, other languages are accepted as they are, warts and all. it's true

Re: any way to initialize an array of structs to void?

2015-09-16 Thread ref2401 via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 14:48:59 UTC, Meta wrote: Don't do this with a dynamic array, though, as they work a bit differently from static arrays. Unfortunately I have to deal with dynamic arrays.

any way to initialize an array of structs to void?

2015-09-16 Thread ref2401 via Digitalmars-d-learn
struct MyStruct { @disable this(); this(int a, string b) { this.a = a; this.b = b; } int a; string b; } I know there is a way to create one instance of `MyStruct` and initialize it to void. MyStruct s = void; s =

Re: any way to initialize an array of structs to void?

2015-09-16 Thread ref2401 via Digitalmars-d-learn
On Wednesday, 16 September 2015 at 14:57:49 UTC, Meta wrote: In that case, you can use std.array.uninitializedArray or std.array.minimallyInitializedArray as needed. http://dlang.org/phobos/std_array.html#uninitializedArray http://dlang.org/phobos/std_array.html#.minimallyInitializedArray

D fund

2015-08-09 Thread ref2401 via Digitalmars-d
Does the fund exist? Are there sponsors? How can one donate some money to D?

Re: D fund

2015-08-09 Thread ref2401 via Digitalmars-d
I don't have much experience and time to contribute to code-base directly. But I'd like to donate some money every month. I think (hope) there are several guys who would like to donate to. There must be the way to do it.

Re: D for Game Development

2015-08-04 Thread ref2401 via Digitalmars-d
On Thursday, 30 July 2015 at 13:43:35 UTC, karabuta wrote: D is really cool and makes a good candidate for developing a game. Are there any guys out there using D for indie games? For some time I have been seeing some cool game engine being developed in the DUB repo. What more is happening? I

Re: D for Game Development

2015-08-04 Thread ref2401 via Digitalmars-d
On Tuesday, 4 August 2015 at 19:13:44 UTC, Rikki Cattermole wrote: On 5/08/2015 6:59 a.m., develop32 wrote: On Thursday, 30 July 2015 at 13:43:35 UTC, karabuta wrote: D is really cool and makes a good candidate for developing a game. Are there any guys out there using D for indie games? Not

D array to void* and back

2015-08-03 Thread ref2401 via Digitalmars-d-learn
Hello everyone, I pass a D array as void* into a function. When I'm trying to cast a void* parameter to a D array I get 'Access Violation' error. However if I define ArrayLike struct which looks like D array then casting will succeed. What should I do? Should I stick to ArrayLike wrapper and

Re: D array to void* and back

2015-08-03 Thread ref2401 via Digitalmars-d-learn
On Monday, 3 August 2015 at 21:28:29 UTC, Ali Çehreli wrote: But you still need to communicate how many elements there are in the array. (I used literal 3). Yes I do. I hope there is a neat way to pass array's length too.

Re: Negation of attributes (DIP 79)

2015-06-02 Thread ref2401 via Digitalmars-d
On Tuesday, 2 June 2015 at 10:29:35 UTC, Daniel Kozak wrote: I am working on dip which will try to addressed negation of attributes issue. http://wiki.dlang.org/DIP79 You propose to add extra difficulty to the language and the only reason is If you need add few methods which are virtual or

Re: Negation of attributes (DIP 79)

2015-06-02 Thread ref2401 via Digitalmars-d
This is by far not the only reason. It is just as well useful for all other attributes: const, pure, @safe/@system, @nogc, and maybe UDAs. It's long been recognized that a mechanism to switch off a scope-wide attribute would be useful. Switching attributes on and off will make your code

'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same as 'const scope' but I can't write 'const scope ref' though it's legal to write 'in ref'. Thank you

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
On Friday, 15 May 2015 at 16:30:29 UTC, Steven Schveighoffer wrote: On 5/15/15 12:04 PM, ref2401 wrote: What is the difference between 'const' and 'in' parameter storage classes? When should I use 'const' or 'in'? The documentation says 'in' is the same as 'const scope' but I can't write

Re: 'const' and 'in' parameter storage classes

2015-05-15 Thread ref2401 via Digitalmars-d-learn
On Friday, 15 May 2015 at 16:08:31 UTC, Adam D. Ruppe wrote: The scope storage class means you promise not to escape any reference to the data. This isn't enforced but it is similar in concept to Rust's borrowed pointers - it may someday be implemented to be an error to store them in an

Error: cannot modify struct arr[0] MyStruct with immutable members

2015-05-11 Thread ref2401 via Digitalmars-d-learn
struct MyStruct { this(int a, int b) { this.a = a; this.b = b; } immutable int a; immutable int b; } void main(string[] args) { MyStruct[] arr = new MyStruct[3]; arr[0] = MyStruct(5, 7); } Why does it

Re: Error: cannot modify struct arr[0] MyStruct with immutable members

2015-05-11 Thread ref2401 via Digitalmars-d-learn
On Monday, 11 May 2015 at 13:44:14 UTC, Adam D. Ruppe wrote: On Monday, 11 May 2015 at 13:37:27 UTC, ref2401 wrote: Why does it happen? You'd just be writing to the immutable memory through a different name. Consider if someone took a reference to one of those immutable ints, expecting it

Delegate type deduction compile error

2015-04-25 Thread ref2401 via Digitalmars-d-learn
struct MyStruct {} void main(string[] args) { string str = blah-blah; auto d1 = (MyStruct) { writeln(delegate-str: , str); }; writeln(typeid(typeof(d1))); } dmd: 2067 os: Win8.1 build script: dmd main.d -ofconsole-app.exe -debug -unittest -wi - if delegate has no

function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
What advantages do ref params give over pointer params? struct MyStruct { string str; this(string str) { this.str = str; } } void processRef(ref MyStruct ms) { writeln(processRef: , ms); } void processPointer(MyStruct* ms) { writeln(processPointer: , *ms); }

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
Thank you

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
processPointer(ms); I think doing this way is more descriptive. Now all readers know that ms might be changed inside the function.

Re: Fibers and async io stuff for beginners

2015-04-23 Thread ref2401 via Digitalmars-d-learn
Awesome!

Fibers and async io stuff for beginners

2015-04-23 Thread ref2401 via Digitalmars-d-learn
I'm intrested in fibers and async io. Could anyone suggest articles, books or tutorials about the subject? Thank you

Re: Invalid Floating Point Operation (DMD 2067)

2015-04-16 Thread ref2401 via Digitalmars-d-learn
Builds and runs fine for me. What is your OS and build command? -Steve Win 8.1 dmd main.d -ofmain.exe -debug -unittest -wi if %errorLevel% equ 0 (main.exe)

Invalid Floating Point Operation (DMD 2067)

2015-04-16 Thread ref2401 via Digitalmars-d-learn
Hi Everyone, After I switched to DMD 2067 my code that previously worked began crashing. If I change the return statement in the matrixOrtho function from: return Matrix(...); to: Matrix m = Matrix(...); return m; then the error won't occur anymore. What is going on?

An input range iteration question

2015-04-08 Thread ref2401 via Digitalmars-d-learn
If Iterator is a struct then Iterator.input won't be adjusted properly when the foreach loop ends. Iterator.input still holds abcde value. If i mark Iterator as class then Iterator.input will be an empty string after the foreach loop. Could anyone explain me the difference please? Thank you.

struct variable initialized with void.

2015-03-31 Thread ref2401 via Digitalmars-d-learn
struct MyStruct { // stuff } void main(string[] args) { MyStruct s1 = void; } Could anyone describe me what this initialization does, please? When do I need to use the void initialization?

Re: struct variable initialized with void.

2015-03-31 Thread ref2401 via Digitalmars-d-learn
Thank you.

final methods by default

2015-03-20 Thread ref2401 via Digitalmars-d-learn
Why aren't methods of class final by default?

Explicit Interface Implementation

2015-02-14 Thread ref2401 via Digitalmars-d-learn
Does D provide a way for explicit interface implementation? [C#] https://msdn.microsoft.com/en-us/library/ms173157.aspx

Re: spawn/executeInNewThread and module this/~this

2015-01-29 Thread ref2401 via Digitalmars-d-learn
It's written here: http://dlang.org/module.html#staticorder

Re: static class vs. static struct

2015-01-27 Thread ref2401 via Digitalmars-d-learn
For several times I've met struct(or static struct) usage in Phobos for singleton pattern implementation. Unfortunately now i can remember only core.runtime.Runtime. So I've got a question. Why do Phobos guys use struct or static struct for or singleton pattern implementation? Why don't use

static class vs. static struct

2015-01-26 Thread ref2401 via Digitalmars-d-learn
What's the difference between static class and static struct? What should i use?

Re: dlang.org redesign n+1

2015-01-22 Thread ref2401 via Digitalmars-d
Can we just get back the old design, please?

Re: redirecting the unittests error output

2015-01-15 Thread ref2401 via Digitalmars-d-learn
Thank you.

redirecting the unittests error output

2015-01-14 Thread ref2401 via Digitalmars-d-learn
How can i redirect the unittests error output to a file?

Re: redirecting the unittests error output

2015-01-14 Thread ref2401 via Digitalmars-d-learn
Unfortunately i'm new to using shells. I use standard windows cmd. Here is my script: dmd main.d -debug -unittest -wi if %errorLevel% equ 0 ( start main.exe ) else ( echo --- Building failed! --- pause ) I wrote start main.exe 2 errorFile but it doesn't work.

Re: core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-12 Thread ref2401 via Digitalmars-d-learn
Thanks for the links. I have shared class instance. There are two threads which can read/write fields of the class. As i understand i can declare class as synchronized or i can read/write using atomicLoad/atomicStore. What's the difference between these two approaches? In what circumstances

core.atomic: atomicFence, atomicLoad, atomicStore

2015-01-10 Thread ref2401 via Digitalmars-d-learn
I learned how 'atomicOp' and 'cas' work and why i need them from the following sources: http://ddili.org/ders/d.en/concurrency_shared.html (Ali's book) http://www.informit.com/articles/article.aspx?p=1609144 (Andrei's book) Can anybody tell me how 'atomicFence', 'atomicLoad' and

formattedWrite writes nothing

2014-05-02 Thread ref2401 via Digitalmars-d-learn
class MyClass { Appender!string _stringBuilder; this() { _stringBuilder = Appender!string(null); _stringBuilder.clear(); } @property string str() { return _stringBuilder.data; } void append(string