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
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[]
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:
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
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,
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.
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
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
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?
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
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
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
On Thursday, 14 January 2016 at 02:13:20 UTC, Ilya wrote:
std.memory --Ilya
That's a good one.
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.
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?
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.'
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
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;
DMD 2.069.1
OS Win8.1 Enterprise
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
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
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
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.
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
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
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
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
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.
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
If I declare a class as `final` do I have to mark all methods of
the class as `final` too?
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
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.
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 =
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
Does the fund exist?
Are there sponsors?
How can one donate some money to 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.
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
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
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
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.
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
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
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
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
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
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
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
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
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);
}
Thank you
processPointer(ms);
I think doing this way is more descriptive.
Now all readers know that ms might be changed inside the function.
Awesome!
I'm intrested in fibers and async io.
Could anyone suggest articles, books or tutorials about the
subject?
Thank you
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)
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?
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 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?
Thank you.
Why aren't methods of class final by default?
Does D provide a way for explicit interface implementation?
[C#] https://msdn.microsoft.com/en-us/library/ms173157.aspx
It's written here:
http://dlang.org/module.html#staticorder
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
What's the difference between static class and static struct?
What should i use?
Can we just get back the old design, please?
Thank you.
How can i redirect the unittests error output to a file?
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.
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
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
class MyClass {
Appender!string _stringBuilder;
this() {
_stringBuilder = Appender!string(null);
_stringBuilder.clear();
}
@property string str() {
return _stringBuilder.data;
}
void append(string
70 matches
Mail list logo