Re: Doubt about this book: The D Programming Language

2018-12-20 Thread MachineCode via Digitalmars-d-learn
On Sunday, 16 December 2018 at 19:57:08 UTC, Steven Schveighoffer wrote: On 12/16/18 1:37 PM, Marko wrote: On Amazon The D Programming Language has good reviews but it's 8 years old. So is this book still relevant today? Mostly, yes. And it's a pretty good book, even if it has some outdated

Re: Checking if CTFE is used?

2018-12-20 Thread MachineCode via Digitalmars-d-learn
On Tuesday, 18 December 2018 at 14:23:38 UTC, berni wrote: On Tuesday, 18 December 2018 at 13:53:01 UTC, Stefan Koch wrote: Why would you need to know? Well, first out of curiosity. But there are also other reasons: I've got a large immutable array. Without CTFE I'd use some php script and

Check if give an array is equal to first elements in another array

2014-10-15 Thread MachineCode via Digitalmars-d-learn
Is there one function in the Phobos library to check if give an array is equal to first elements in another array? e.g, f(a, b) the entire b array must match to first elements in a and then return true otherwise false, ie: a[0 .. b.length] == b probably there's no such a function (but I

Re: Beginner ?. Why does D suggest to learn java

2014-10-16 Thread MachineCode via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:42:21 UTC, Ali Çehreli wrote: On 10/16/2014 03:26 PM, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for

Re: Global const variables

2014-10-21 Thread MachineCode via Digitalmars-d-learn
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'

Where is a variable declared in a module allocated?

2014-10-25 Thread MachineCode via Digitalmars-d-learn
Where is a variable declared in a module allocated? is it same as a C's global? for example: module foo; int myvar;

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread MachineCode via Digitalmars-d-learn
On Monday, 27 October 2014 at 00:26:00 UTC, ketmar via Digitalmars-d-learn wrote: Hello. let's assume we have this code: void doWrite(A...) (A args) { import std.stdio; import std.conv; writeln(to!string(args[0])); } void main () { char[3] a0 = abc; char[3] a1 =

Re: forum.dlang.org open source?

2014-10-26 Thread MachineCode via Digitalmars-d-learn
On Sunday, 26 October 2014 at 23:57:41 UTC, Mike wrote: Does forum.dlang.org have an open source repository somewhere that we can contribute pull requests to, or are bug reports to recommended procedure. I see that the left navigation menu needs updating, and I think we can wordsmith the

Re: Where is a variable declared in a module allocated?

2014-10-26 Thread MachineCode via Digitalmars-d-learn
On Saturday, 25 October 2014 at 22:16:12 UTC, John Colvin wrote: On Saturday, 25 October 2014 at 21:52:13 UTC, MachineCode wrote: Where is a variable declared in a module allocated? is it same as a C's global? for example: module foo; int myvar; that is in thread local storage. __shared,

Re: passing non-dynamic arrays to variadic functions

2014-10-26 Thread MachineCode via Digitalmars-d-learn
On Monday, 27 October 2014 at 02:27:32 UTC, ketmar via Digitalmars-d-learn wrote: On Mon, 27 Oct 2014 02:19:49 + MachineCode via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: It worked fine for me. Output: abc abc Environment: Win 8.1 64-bit (but dmd target is 32-bit

Re: Reflections on isPalindrome

2014-10-28 Thread MachineCode via Digitalmars-d-learn
On Tuesday, 28 October 2014 at 14:09:50 UTC, MattCoder wrote: On Tuesday, 28 October 2014 at 13:30:05 UTC, Nordlöw wrote: On Tuesday, 28 October 2014 at 11:51:42 UTC, MattCoder wrote: I forgot to say that I'm compiling with DMD without any compiler hints/optimizations. Try compiling with DMD

Re: help

2014-11-20 Thread MachineCode via Digitalmars-d-learn
On Thursday, 20 November 2014 at 07:25:45 UTC, Suliman wrote: You need to check if remote file exist of server and only after it download шею is this software name written in russian language?

Re: Why the DMD Backend?

2014-11-30 Thread MachineCode via Digitalmars-d-learn
On Friday, 28 November 2014 at 19:59:40 UTC, Xinok wrote: Given that we have GDC with the GCC backend and LDC with the LLVM backend, what are the benefits of keeping the DMD compiler backend? It seems to me that GCC and LLVM are far more developed and better supported by their respective

Re: Why the DMD Backend?

2014-11-30 Thread MachineCode via Digitalmars-d-learn
On Sunday, 30 November 2014 at 22:15:44 UTC, bearophile wrote: MachineCode: I tried to use others compilers which use gcc/llvm as backend where I had to do alot of workaround just to make it working on Windows that I just gave up. I using ldc2 on Windows with no problems, and the

Re: Why the DMD Backend?

2014-12-02 Thread MachineCode via Digitalmars-d-learn
On Sunday, 30 November 2014 at 02:07:16 UTC, ketmar via Digitalmars-d-learn wrote: On Sat, 29 Nov 2014 22:57:52 -0300 Ary Borenszweig via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: besides, i don't want to use anything llvm-related. Why not? let's say that there is some

How can I define a label inside a switch?

2014-12-14 Thread MachineCode via Digitalmars-d-learn
I used to do it in C but in D it's giving this compile error message: switch case fallthrough - 'use goto case;' if intended Here's the code: switch(value) { // alof of cases here // ... white: // regular label case 'a': case 'c': case 'd':

Re: How can I define a label inside a switch?

2014-12-14 Thread MachineCode via Digitalmars-d-learn
On Sunday, 14 December 2014 at 18:27:28 UTC, ketmar via Digitalmars-d-learn wrote: On Sun, 14 Dec 2014 18:24:39 + MachineCode via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I used to do it in C but in D it's giving this compile error message: switch case fallthrough