On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote:
Hello, I have followed the instructions here
(http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to
install DMD, druntime and phobos from source.
My platform is Ubuntu 15.10 x64.
This is the error I get:
http://pastebin.com
Hello, I have followed the instructions here
(http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to
install DMD, druntime and phobos from source.
My platform is Ubuntu 15.10 x64.
This is the error I get:
http://pastebin.com/kWCv0ymn
On Saturday, 5 March 2016 at 14:08:28 UTC, Mike Parker wrote:
On Saturday, 5 March 2016 at 14:01:11 UTC, Mike Parker wrote:
If you use WinMain, you do not need that flag.
Actually, I need to amend that. It isn't needed with WinMain
when using the Microsoft linker, but it is when using OPTLIN
I added a WinMain function to my application because I don't want
it to open a console when running on windows.
But now it doesn't even start...
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
bool b = true;
while
On Friday, 4 March 2016 at 13:53:22 UTC, aki wrote:
Is it okay to modify associative array while iterating it?
import std.stdio;
void main() {
string[string] hash = [ "k1":"v1", "k2":"v2" ];
auto r = hash.byKeyValue();
while(!r.empty) {
auto key = r.front
Hello.
I'm trying to install DCD on windows 8.1 using DUB but I get an
error.
When executing "dub build --build=release --config=client" I get
the following error:
=> Root package dcd contains reference to invalid package
libdparse >=0.5.0 <0.6.0 <=
On Monday, 22 February 2016 at 23:03:38 UTC, Jonathan M Davis
wrote:
On Monday, February 22, 2016 22:22:01 Minas Mina via
Digitalmars-d-learn wrote:
[...]
Short answer:
[...]
Great, thanks.
I'm trying to inherit from Logger, and I my custom logger to
print to stdout using writeln(). But I can't because writeLogMsg
is @safe, whereas writeln() is @system.
Why is writeLogMsg @safe? This is too restrictive.
On Sunday, 7 February 2016 at 19:43:23 UTC, rsw0x wrote:
On Sunday, 7 February 2016 at 19:39:27 UTC, rsw0x wrote:
On Sunday, 7 February 2016 at 19:27:19 UTC, Charles Hixson
wrote:
If I define a shared ulong variable, is increment an atomic
operation?
E.g.
shared ulong t;
...
t++;
It seems
On Wednesday, 14 March 2012 at 05:44:24 UTC, Chris Pons wrote:
I'm new, and trying to incorporate assert and enforce into my
program properly.
My question revolves around, the fact that assert is only
evaluated when using the debug switch. I read that assert
throws a more serious exception th
On Wednesday, 23 December 2015 at 22:29:31 UTC, Andrew Chapman
wrote:
On Wednesday, 23 December 2015 at 11:46:37 UTC, Jakob Ovrum
wrote:
On Wednesday, 23 December 2015 at 11:21:32 UTC, Jakob Ovrum
wrote:
Dynamic memory allocation is expensive. If the string is
short-lived, allocate it on the st
bump
I have written a script that visits all directories in the
current directory and executes a command. In my case, "git pull".
When running the script serially, everything is fine. All git
repositories are pulled.
But I'd like to pull multiple repositories in parallel to speed
things up.
So I
Oh and another thing: The program compiles right now but I can't
execute it because for some reason:
Failed to create a child process.
Cannot run program
"/home/minas/Projects/eclipse_workspace/DTest/dtest" (in
directory "/home/minas/Projects/eclipse_workspace/DTest"
relict-sfml2": "~2.1"
},
"versions-x86_64": ["UseAmd64Impl"],
"lflags": ["-I/home/minas/.dub/packages/derelict-sfml2-2.1/lib",
"-LDerelictSFML2"]
}
The way I specified the library seems very ugly to me.
Essentially it's a full path... How can I tell dub to use it by
locating it automatically from its local repository?
On Tuesday, 21 October 2014 at 08:02:52 UTC, bearophile wrote:
Currently this code gets rejected:
const int[] a = [1];
void main() pure {
auto y = a[0];
}
test2.d(3,14): Error: pure function 'D main' cannot access
mutable static data 'a'
test2.d(3,14): Error: pure function 'D main' cannot
On Thursday, 30 May 2013 at 16:48:33 UTC, bearophile wrote:
Shriramana Sharma:
Hello. I have always loved the readability of C++'s
and/or/not/xor
word-like logical operators but It doesn't seem to be
available in D.
and/or/not are less visually noisy, they look better than the
ugly &&/||/!
On Tuesday, 7 May 2013 at 23:09:29 UTC, Matic Kukovec wrote:
Hi
I'm running Windows Vista 64 with dmd 2.062.
I have a simple program:
import std.stdio, core.memory, std.cstream;
void main()
{
string[] temp_array;
for(int i=0;i<500;i++)
{
++temp_arra
On Saturday, 27 April 2013 at 18:14:11 UTC, Michael wrote:
According to http://dlang.org/const3.html
The simplest immutable declarations use it as a storage class.
It can be used to declare manifest constants.
So, immutable string s = "..."; should be a manifest constant.
If it is a constant
If you aren't comfortable with either C++ or D I would suggest to
do the tutorials with C++, as there are no OpenGL tutorials for
D. Don't try to learn two things at the same time.
On Saturday, 20 April 2013 at 15:49:47 UTC, Dementor561 wrote:
I have all the needed files to use Direlect3, and I have Mono-D
installed on Xamarin, I was wondering how I could put it all
together in a project.
1) Do you use windows or linux?
2) Have you built derelict3?
3) If you are using li
On Monday, 8 April 2013 at 12:37:34 UTC, Simen Kjaeraas wrote:
On 2013-04-08, 14:23, Minas Mina wrote:
How can I define operator += for a struct?
http://dlang.org/operatoroverloading.html
In short:
struct S {
auto opOpAssign( string op : "+" )( S other ) {
// Do
How can I define operator += for a struct?
auto in?
in ref?
Why is "const ref" not a good choice?
On Friday, 25 January 2013 at 16:19:15 UTC, Maxim Fomin wrote:
On Friday, 25 January 2013 at 15:15:32 UTC, Minas Mina wrote:
I found what the root of all evil was - The GC.
After disabling it, the program runs fine.
Perhaps you was working with C code, GC + legacy code sometimes
lead to
Maybe. I am re-writing the code in C++ to see, and also to
compare the performance.
I found what the root of all evil was - The GC.
After disabling it, the program runs fine.
On Thursday, 24 January 2013 at 13:22:20 UTC, Maxim Fomin wrote:
On Thursday, 24 January 2013 at 10:14:29 UTC, Minas Mina wrote:
I am trying to create a BVH tree structure to speed up
raytracing. So far it has been fine. I have created the BVH
tree. It works for 202 triangles/spheres
I am trying to create a BVH tree structure to speed up
raytracing. So far it has been fine. I have created the BVH tree.
It works for 202 triangles/spheres.
However, when the scene has more spheres/triangles, I get a
segmentation fault when the rays are traces, not when the tree is
being buil
On Wednesday, 16 January 2013 at 14:15:46 UTC, n00b wrote:
Nevermind, found it myself.
SysTime* sys = new SysTime(standardTime, UTC());
sys.hour;
Le 16/01/2013 08:07, n00b a écrit :
Hello, I'm kinda ashamed to ask that here, but std.datetime
documentation is so complex... I only want to get h
So when it will be fixed I will be able to write:
void foo(auto ref Vector3 v);
and it will pass copies or references depending on the situation?
On Friday, 28 December 2012 at 12:47:03 UTC, Namespace wrote:
On Friday, 28 December 2012 at 12:28:01 UTC, bearophile wrote:
Namespace:
How likely is it that "auto ref" will implemented in this
release?
Walter wants to release 2.061 "soon". So maybe that's for the
successive (unstable?) ver
On Sunday, 23 December 2012 at 23:59:55 UTC, Jonathan M Davis
wrote:
On Monday, December 24, 2012 00:48:01 Namespace wrote:
but Andrei is dead set against
- Jonathan M Davis
Why?
On Sunday, 23 December 2012 at 20:40:09 UTC, Namespace wrote:
Minas Mina:
Show me the whole code, I think that your opBinary functions
returns rvalues.
This would be a good and important case for "auto ref". But
until now it is only for template paramters...
struct Vector3
{
On Sunday, 23 December 2012 at 12:08:47 UTC, Namespace wrote:
As long as you use structs this should work, as you can see
here: http://dpaste.dzfl.pl/03adf3d1
But if you use classes, it does not work anymore. So I like it
a lot, that it works with structs. :)
Thank you. I had forgotten to supp
On Wednesday, 12 December 2012 at 14:28:48 UTC, Zardoz wrote:
How I can compile with static linking with dmd ?
I try with dmd -L-static
but i get this error :
/usr/bin/ld: cannot find -lgcc_s
I used before gdc with -static options and owrked well on it,
but I need to use now dmd.
Try usi
Is there a library that I can use to connect to an SQL Server
database? (I need to use it on both linux and windows).
On Tuesday, 11 September 2012 at 12:06:29 UTC, ElfQT wrote:
Hi.
I would like some sample code which demonstrates how can I
modify a DirectX 9 texture. (C++ or D, doesn't matter.) I have
a texture, like a billboard, and I would like to draw on that.
I already looked on google, on different ga
import std.stdio;
enum PI = 3.14;
void main()
{
writeln(typeid(typeof(PI)));
}
It prints "double". Shouldn't it be immutable(double). I think it
would make more sense, as it is a constant. Plus, it could be
shared among threads.
Why is it "if( __ctfe )" and not
static if.. ?
Is there n article that explains the different types of Ranges?
(InputRange, ForwardRange, etc) and their usage?
I have this struct:
struct S
{
int[] t;
@disable this();
this(int sz)
{
t = new int[sz];
t[] = 1;
}
S opCall(int sz)
{
S s = S(sz);
return s;
I don't know about the runtime, but destructors are not called
(not sure about module destructors)
import std.stdio;
import std.c.stdlib;
void main()
{
S s;
exit(-1);
}
struct S
{
~this()
{
writeln("destructor");
}
}
This prints
On Sunday, 19 August 2012 at 23:48:01 UTC, Minas Mina wrote:
That's what I do:
import std.c.stdlib;
void main(string[] args)
{
if( args.length == 1 )
{
writeln("Some arguments, please!");
exit(-1);
}
}
Sorry, forgot to import std.stdio.
That's what I do:
import std.c.stdlib;
void main(string[] args)
{
if( args.length == 1 )
{
writeln("Some arguments, please!");
exit(-1);
}
}
On Monday, 13 August 2012 at 22:06:08 UTC, Namespace wrote:
Can i link an assembler file .s with dmd like gcc with "gcc
out.s any.c -o out.exe"? If so, how?
.s, .c, .d files (source files), are not linked. What is linked,
are object files (.obj or .o).
GCC either compiles the .s file to an o
On Monday, 6 August 2012 at 15:56:52 UTC, Namespace wrote:
Take a look into std.math:
https://github.com/D-Programming-Language/phobos/blob/master/std/math.d
I found this:
real sin(real x) @safe pure nothrow; /* intrinsic */
And these:
creal sin(creal z) @safe pure nothrow
{
creal cs =
On Monday, 6 August 2012 at 15:21:38 UTC, Philippe Sigaud wrote:
On Mon, Aug 6, 2012 at 3:54 PM, Minas Mina
wrote:
Something like this:
template fib(ulong n)
{
static if( n < 2 )
const fib = n;
else
const fib = fib!(n-1) + fib!(
On Monday, 6 August 2012 at 15:21:38 UTC, Philippe Sigaud wrote:
On Mon, Aug 6, 2012 at 3:54 PM, Minas Mina
wrote:
Something like this:
template fib(ulong n)
{
static if( n < 2 )
const fib = n;
else
const fib = fib!(n-1) + fib!(
zfl.pl/e3f26239
Minas : I don't know if your PC is outdated, but it's weird. :/
It's Ubuntu 12.04 running on an Intel i5.
That's what I tried to calculate:
static x = fib(40);
ulong fib(ulong n)
{
if(n < 2)
return n;
else
Something like this:
template fib(ulong n)
{
static if( n < 2 )
const fib = n;
else
const fib = fib!(n-1) + fib!(n-2);
if( n < 2)
return n;
return fib(n-1) + fib(n-2);
}
It doesn't work of course, as I am in
Maybe you need a cast before malloc to convert it to a
"s_blockInfo*"?
I want to write a fibonacci(n) function that calculates the
result.
a) if n is known at compile time, use a template
b) if not, use a normal function
I know how to write a template version:
template fib(ulong n)
{
static if( n < 2 )
const fib = n;
else
On Sunday, 5 August 2012 at 16:42:16 UTC, Adam D. Ruppe wrote:
On Sunday, 5 August 2012 at 16:30:48 UTC, Minas Mina wrote:
Thank you. Is it the way it is to have compatibility with C
structs?
I'm not sure... I think so in part, but I think another part of
it is to make sure that s
Thank you. Is it the way it is to have compatibility with C
structs?
I want to make a struct that defines a constructor:
struct Point
{
this()
{
}
}
However I get a compiler error:
"constructor main.Point.this default constructor for structs only
allowed with @disable and no body"
I wrote a @disable next to it but same error. I don't u
On Tuesday, 31 July 2012 at 09:41:31 UTC, maarten van damme wrote:
I now tried to bring it to the next level, using concurrency to
bread
a couple of populations and make the best solutions migrate
between
them.
But, to use concurrency in D, one has to continually cast
between
immutable, cast
Thank you for your reply.
I have some more questions:
I simplified my example. Now my monitor is used for mutual
exclusion, to understand how monitors work first.
// 3 threads are running P() - the main thread is not one of them
void P()
{
while( run )
{
monit
I agree that having the compiler make warnings about unused
variables is a really good idea!!!
Java has it and when I program in eclipse it's really useful
because the editor can highlight the particular lines.
Thanks for the answers.
So clear() or destroy() in 2.060 be used to call the destructor,
but the actual memory of the object won't be freed, right?
Is this is true, why wasn't "delete" changed to behave like
destroy()?
I think having the delete keyword for classes was a very good
thing, altough I don't know the problems it has for the GC and
probably other things.
Consider this scenario:
class Base
{
// ...
}
class Derived : Base
{
// ...
FILE *f;
this()
I'm using condition variables to implement a monitor that
simulates the producer-consumer(unbounded buffer) scenario.
Note:
monitor is __gshared and is initialized in main(). Then the other
threads are created and run.
There is one producer thread, and 5 consumer threads.
void producer()
{
I have this code:
import std.stdio;
void main()
{
f();
g();
}
void f()
{
writeln("f()");
}
void g()
{
writeln("g()");
}
I compile with the command:
dmd test.d -profile
Then I execute it. It prints:
f()
g()
as expected. Shouldn't it print profiling informatio
Sorry, I just saw the generated file...
:p
Try -L-lX11
On Saturday, 14 July 2012 at 09:21:27 UTC, David Nadlinger wrote:
On Saturday, 14 July 2012 at 09:15:55 UTC, Minas Mina wrote:
Isn't this the way shared is used (or should be used)?
Should be used: probably yes. But functions/methods which are
able to act on shared data must be marke
Thanks, I've got another problem:
void f()
{
sema.wait();
++x;
sema.notify();
}
sema is the global shared Semaphore (as above)
main.d(29): Error: function core.sync.semaphore.Semaphore.wait ()
is not callable using argument types () shared
main.d(29):
I'm want to "play" a bit with thread syncronization...
So this is a (big) part of my code. The other is the imports, the
thread starting and the printing of x.
shared int x;
shared Semaphore sema;
void main(string[] args)
{
auto t1 = new Thread(&f);
auto t2 = new Thread(&g);
I guess it's because you have an array of constants (immutables).
The array is not immutable though. I could be wrong, I'm not an
expert or D syntax :)
On Thursday, 12 July 2012 at 14:42:17 UTC, Ali Çehreli wrote:
On 07/12/2012 07:13 AM, Minas wrote:
Thanks a lot!
So what is the problem with (logical)const? Is it needed that
much? And why some methods (toString(), toHash()) HAVE to be
const? I mean, what's the problem if they aren't?
Thanks a lot!
So what is the problem with (logical)const? Is it needed that
much? And why some methods (toString(), toHash()) HAVE to be
const? I mean, what's the problem if they aren't?
I'm fairly new to D, but I have been using C++ for a while now
(about 5 years, selftaught).
From what I have learned, const in C++ is inconsistent.
For example:
int main()
{
const int x = 0; // could be placed in ROM because it's known
at compile time
}
void f(int x)
{
const int y = x
On Wednesday, 27 June 2012 at 23:50:17 UTC, Ali Çehreli wrote:
On 06/27/2012 04:05 PM, Adam Burton wrote:
>> For example I would like to
>> have a thread calculate the sum of the first half of an array
>> while another thread would calculate the other half, and I
could
>> add the two results at
You all helped, thank you :)
I will read the concurrency part tomorrow!
I have been "playing" latetly with std.concurrency and
core.thread. I like both, but they are entirely different
approaches to concurrency.
std.concurrency: Uses message passing. Does not allow passing of
mutable types.
core.thread: Essentially the same as the approach taken by Java.
1) Is o
Doesn't Andrei plan to do something about this module?
Thank you for your reply. Yes, std.container really sucks.
Anyway, I made my program using C++ and STL
On Wednesday, 27 June 2012 at 09:52:14 UTC, Tobias Pankrath wrote:
On Wednesday, 27 June 2012 at 09:37:01 UTC, Minas Mina wrote:
How can I do that?
Why not list.remove(x); like in STL?
std.container encodes the complexity of operations in the
method names. There is no way to remove a range
How can I do that?
Why not list.remove(x); like in STL?
Thank you very much :)
I like the "you are done :)" approach!
I'm sorry, what I meant was "how to interface to C code". Sorry
for writing it in a bad way.
Do I just declare the C code as extern and then link together
with the C .lib/.o/.so file? (I'm in Ubuntu)
What about the stuff that is in header files?
With
ints, the best we can do is 0. With floats, NaN makes it better.
With the logic that NaN is the default for floats, 0 is a very
bad choice for ints. It the worst we could do. Altough I
understand that setting it to something else like -infinity is
still not a good choice.
I think that
The idea isn't being "practical" exactly. The idea was to use
invalid
values as defaults. Unfortunately things like ints don't have
invalid
values, so they chose zero. The idea is to make people
initialize their
variables.
I understand the logic, but I still disagree. No offense :)
I don't
I agree that the default value for floats/doubles should be zero.
It feels much more natural.
I think the problem here is that people are thinking about some
stuff too much. D is a rather new language that wants to be
practical. Floats defaulting to NaN is NOT practical FOR MOST
PEOPLE when a
Oops, that doesn't fix the error. Seg. faults occurs...
I think I found it!
I have modified main:
void main()
{
DerelictSDL.load();
int val = SDL_Init(SDL_INIT_EVERYTHING);
writeln(val);
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32,
SDL_SWSURFACE);
writeln("ok");
DerelictSDL
It certainly doesn't happen inside SDL_Init because "writeln()"
is shown even when the seg. fault occurs... It has to be inside
SDL_SetVideoMode.
I forgot about that :p
Here it is:
Starting program:
/home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template
[Thread debugging using libthread_db enabled]
Using host libthread_db library
"/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffee989700 (LWP 13351
,
SDL_SWSURFACE);
}
[/code]
But sometimes (at about 3-5 runs), I get a segmentation fault!
0
bash: line 1: 12951 Segmentation fault (core dumped)
/home/minas/Projects/OpenGL/D_template/D_template/bin/Debug/D_template
0 is the return value of SDL_Init, so everything ok here. I don't
kno
I figured it out, this is the correct:
-L-L/usr/lib/Derelict2 -L-lDerelictSDL -L-lDerelictUtil -L-ldl
I don't know why, but the dl library is needed. Thank you for
your help.
On Thursday, 10 May 2012 at 13:14:36 UTC, Jacob Carlborg wrote:
On 2012-05-10 14:55, Minas wrote:
I have a static library (libDerelictSDL2.a) in
/usr/lib/Derelict3. What
I want to to is just link to that. My code does not use
anything from it.
My .d file is icy.d.
I try to compile using:
a
I have a static library (libDerelictSDL2.a) in
/usr/lib/Derelict3. What I want to to is just link to that. My
code does not use anything from it.
My .d file is icy.d.
I try to compile using:
a) dmd icy.d -I/usr/lib/Derelict3 -L-lDerelictSDL2
b) dmd icy.d -L-I/usr/lib/Derelict3 -L-lDerelictSDL
I'm trying to use std.xml to parse a small snippet of xml (for
now).
This is my code:
[code]
void main(string[] args)
{
string xmlText = "\n" ~
"" ~
" Test" ~
"";
What is the D way to create a directory?
I can use the C function system("mkdir ...") but it doesn't seem
very good to me.
Also, is there a way to require the root password of the user
when going create the directory in a restricted folder (like
/usr) AFTER the application has started?
Tha
On Friday, 13 April 2012 at 16:41:01 UTC, Bystroushaak wrote:
Use std.path.expandTilde() ->
http://dlang.org/phobos/std_path.html#expandTilde
Thank you very much! That did the trick!
auto f = File(expandTilde("~/.config/test.txt","w"));
I am trying to create a file in ~/.config
My code is:
[code]
import std.stdio;
void main()
{
auto f = File("~/.config/minas.txt", "w");
}
[/code]
However, an exception is thrown.
std.exception.ErrnoException@std/stdio.d(288): Cannot open file
`~/.config/minas.txt' in mode `w' (No such
On Thursday, 5 April 2012 at 23:23:54 UTC, Kapps wrote:
On Thursday, 5 April 2012 at 17:22:38 UTC, Minas wrote:
First, you should compile with -O -release -inline and, in this
case, -noboundscheck.
return false;
Results in a 26 times performance increase for me, based off of
There's a small C graphics library called GP142, which I am
trying to port to D on Linux (Ubuntu).
So I compiled the library in gcc, and that gave me the file
gp142.o which I must link together with my D source file.
My code is very simple. I declare the two simplest functions in
GP142, and
99 matches
Mail list logo