Re: extern(C++) in win32.mak

2018-02-07 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 08:28:23 UTC, Seb wrote: On Wednesday, 7 February 2018 at 06:05:54 UTC, Paul D Anderson wrote: Is there anyone who knows the ins and outs of the makefile that can shed some light? Thanks, Paul I recommend cloning DMD directly from git if you want to compile

Re: extern(C++) in win32.mak

2018-02-07 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 7 February 2018 at 06:18:04 UTC, rikki cattermole wrote: On 07/02/2018 6:05 AM, Paul D Anderson wrote: I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); That is a string import

extern(C++) in win32.mak

2018-02-06 Thread Paul D Anderson via Digitalmars-d-learn
I don't understand the following line in dmd/src/win32.mak: extern (C++) __gshared const(char)* ddoc_default = import ("default_ddoc_theme.ddoc"); What does the word "import" mean in this context? I can't find any documentation on the use of import in this way, and the line fails to compile

Re: DMD win32.mak error

2017-03-11 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 11 March 2017 at 18:02:00 UTC, Stefan Koch wrote: On Saturday, 11 March 2017 at 02:25:15 UTC, Paul D Anderson wrote: On Saturday, 11 March 2017 at 00:34:03 UTC, Paul D Anderson wrote: On Friday, 10 March 2017 at 22:04:23 UTC, Paul D Anderson wrote: [...] I see John Colvin has

Re: DMD win32.mak error

2017-03-10 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 11 March 2017 at 00:34:03 UTC, Paul D Anderson wrote: On Friday, 10 March 2017 at 22:04:23 UTC, Paul D Anderson wrote: While building DMD -- "make -fwin32.mak release" -- I received the following error message: echo "2.073.2" > verstr.h Error: don't know how to make

Re: DMD win32.mak error

2017-03-10 Thread Paul D Anderson via Digitalmars-d-learn
On Friday, 10 March 2017 at 22:04:23 UTC, Paul D Anderson wrote: While building DMD -- "make -fwin32.mak release" -- I received the following error message: echo "2.073.2" > verstr.h Error: don't know how to make '../res/default_ddoc_theme/ddoc' --- error level 1 I'm guessing it might be a

DMD win32.mak error

2017-03-10 Thread Paul D Anderson via Digitalmars-d-learn
While building DMD -- "make -fwin32.mak release" -- I received the following error message: echo "2.073.2" > verstr.h Error: don't know how to make '../res/default_ddoc_theme/ddoc' --- error level 1 I'm guessing it might be a build configuration problem on my end, but what is the problem?

Re: bigint compile time errors

2015-07-07 Thread Paul D Anderson via Digitalmars-d-learn
On Sunday, 5 July 2015 at 20:35:03 UTC, Kai Nacke wrote: On Friday, 3 July 2015 at 04:08:32 UTC, Paul D Anderson wrote: On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote: On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote: [...] Should be plusTwo(in BigInt n) instead. Yes,

Re: bigint compile time errors

2015-07-03 Thread Paul D Anderson via Digitalmars-d-learn
On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote: The following code fails to compile and responds with the given error message. Varying the plusTwo function doesn't work; as long as there is an arithmetic operation the error occurs. [...]

bigint compile time errors

2015-07-02 Thread Paul D Anderson via Digitalmars-d-learn
The following code fails to compile and responds with the given error message. Varying the plusTwo function doesn't work; as long as there is an arithmetic operation the error occurs. It seems to mean that there is no way to modify a BigInt at compile time. This seriously limits the usability

Re: bigint compile time errors

2015-07-02 Thread Paul D Anderson via Digitalmars-d-learn
On Friday, 3 July 2015 at 03:57:57 UTC, Anon wrote: On Friday, 3 July 2015 at 02:37:00 UTC, Paul D Anderson wrote: enum BigInt test1 = BigInt(123); enum BigInt test2 = plusTwo(test1); public static BigInt plusTwo(in bigint n) Should be plusTwo(in BigInt n) instead. Yes, I had aliased

Re: function default parameters lost

2015-06-26 Thread Paul D Anderson via Digitalmars-d-learn
On Thursday, 25 June 2015 at 14:17:13 UTC, Paul D Anderson wrote: On Thursday, 25 June 2015 at 07:10:57 UTC, tcak wrote: On Thursday, 25 June 2015 at 04:43:51 UTC, Paul D Anderson wrote: I'm trying to pass a function pointer while keeping the default parameter values intact. Given the

Re: function default parameters lost

2015-06-25 Thread Paul D Anderson via Digitalmars-d-learn
On Thursday, 25 June 2015 at 07:10:57 UTC, tcak wrote: On Thursday, 25 June 2015 at 04:43:51 UTC, Paul D Anderson wrote: I'm trying to pass a function pointer while keeping the default parameter values intact. Given the following: [...] I filed a bug about 2-3 months ago about default

Re: Compiles but does not link

2015-06-24 Thread Paul D Anderson via Digitalmars-d-learn
On Thursday, 25 June 2015 at 00:24:23 UTC, Paul D Anderson wrote: The code snippet below compiles but the linker fails with Error 42: Symbol undefined. What am I doing wrong? void main() { int foo(int a); alias FP = int delegate(int); FP fp = foo; } Paul Uh, never

Compiles but does not link

2015-06-24 Thread Paul D Anderson via Digitalmars-d-learn
The code snippet below compiles but the linker fails with Error 42: Symbol undefined. What am I doing wrong? void main() { int foo(int a); alias FP = int delegate(int); FP fp = foo; } Paul

function default parameters lost

2015-06-24 Thread Paul D Anderson via Digitalmars-d-learn
I'm trying to pass a function pointer while keeping the default parameter values intact. Given the following: import std.traits; import std.stdio; int foo(int a, int b = 1) { return a; } alias FOOP = int function(int, int = 1); struct ST(POOF) { FOOP fctn; this(POOF fctn) {

Re: mixin template question

2015-04-12 Thread Paul D Anderson via Digitalmars-d-learn
On Sunday, 12 April 2015 at 04:04:43 UTC, lobo wrote: On Sunday, 12 April 2015 at 03:51:03 UTC, Paul D Anderson wrote: I don't understand why the following code compiles and runs without an error: import std.stdio; mixin template ABC(){ int abc() { return 3; } } mixin ABC; int abc() {

Re: Function name from function pointer

2015-04-11 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 11 April 2015 at 19:08:50 UTC, Marco Leise wrote: Am Sat, 11 Apr 2015 18:28:35 + schrieb Paul D Anderson claude.re...@msnmail.com: Is there a way to return the name of a function (a string) from a pointer to that function? Function pointer example from D Reference: --- int

Function name from function pointer

2015-04-11 Thread Paul D Anderson via Digitalmars-d-learn
Is there a way to return the name of a function (a string) from a pointer to that function? Function pointer example from D Reference: --- int function() fp; void test() { static int a = 7; static int foo() { return a + 3; } fp = foo; } void bar() { test(); int i = fp();

mixin template question

2015-04-11 Thread Paul D Anderson via Digitalmars-d-learn
I don't understand why the following code compiles and runs without an error: import std.stdio; mixin template ABC(){ int abc() { return 3; } } mixin ABC; int abc() { return 4; } void main() { writefln(abc() = %s, abc()); } Doesn't the mixin ABC create a function with the same

Re: Template Parameter Deduction

2015-03-12 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 23:04:15 UTC, Ali Çehreli wrote: On 03/11/2015 03:44 PM, Paul D Anderson wrote: This used to work in D2.065: given 1) public T mul(T)(in T x, in T y, Context context = T.context) if (isDecimal!T) // one template parameter for the two input values and

Re: Template Parameter Deduction

2015-03-11 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 11 March 2015 at 22:44:12 UTC, Paul D Anderson wrote: This used to work in D2.065: given 1) public T mul(T)(in T x, in T y, Context context = T.context) if (isDecimal!T) // one template parameter for the two input values and 2) public T mul(T, U)(in T x, U n, Context

Template Parameter Deduction

2015-03-11 Thread Paul D Anderson via Digitalmars-d-learn
This used to work in D2.065: given 1) public T mul(T)(in T x, in T y, Context context = T.context) if (isDecimal!T) // one template parameter for the two input values and 2) public T mul(T, U)(in T x, U n, Context context = T.context) if (isDecimal!T isIntegral!U) // two

Re: new error message in 2.066, type bool (const)

2014-08-21 Thread Paul D Anderson via Digitalmars-d-learn
On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson wrote: Re-compiling existing code with version 2.066 generates a lot of errors complaining about implicit conversion to const. Typical is this call (inside a struct with properties 1 2): z.sign = x.sign ^ y.sign; Error:

Re: new error message in 2.066, type bool (const)

2014-08-21 Thread Paul D Anderson via Digitalmars-d-learn
On Friday, 22 August 2014 at 01:25:05 UTC, Paul D Anderson wrote: On Wednesday, 20 August 2014 at 20:46:20 UTC, Paul D Anderson I don't know if this is expected behavior that just wasn't enforced before, or if this is something new. Either way I don't like it. And I'm a little surprised I'm

new error message in 2.066, type bool (const)

2014-08-20 Thread Paul D Anderson via Digitalmars-d-learn
Re-compiling existing code with version 2.066 generates a lot of errors complaining about implicit conversion to const. Typical is this call (inside a struct with properties 1 2): z.sign = x.sign ^ y.sign; Error: None of the overloads of 'sign' are callable using argument types bool

Re: new error message in 2.066, type bool (const)

2014-08-20 Thread Paul D Anderson via Digitalmars-d-learn
What changed? It ran okay with early beta versions, but not with the release. Paul It compiles in beta-5 but not beta-6. Is the list of changes in the beta testing wiki complete? None seem pertinent. monarch_dodra: Thanks for checking. I was trying to avoid tearing everything down. I

Templates and function parametes

2014-08-09 Thread Paul D Anderson via Digitalmars-d-learn
When I try to compile these two functions, the second function is flagged with an already defined error: bool testRoundTrip(T, U)(T first, U second) if (isIntegral!T isFloatingPoint!U) { return false; } bool testRoundTrip(U, T)(U first, T second) if (isIntegral!T isFloatingPoint!U) {

Re: Templates and function parametes

2014-08-09 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 9 August 2014 at 07:07:42 UTC, Rikki Cattermole wrote: Cannot reproduce on either 2.065 or git head (according to dpaste). You are right. I had the functions in a unittest block that got executed more than once so the second execution was a redefinition. Thanks for taking

Re: template mixins for boilerplate

2014-06-21 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 21 June 2014 at 11:12:18 UTC, Artur Skawina via Digitalmars-d-learn wrote: On 06/21/14 05:32, Paul D Anderson via Digitalmars-d-learn wrote: I can't use a template mixin: mixin template Function(string name) { const char[] Function = public static int ~ name ~ () { return

template mixins for boilerplate

2014-06-20 Thread Paul D Anderson via Digitalmars-d-learn
I am misunderstanding something about using mixins for boilerplate code. I've got a set of functions all of which do the same thing: public static int fctn1() { return other.place.fctn1; } I can't use a string mixin to generate the code: template Function(string name) { const char[]

enum functions

2014-06-20 Thread Paul D Anderson via Digitalmars-d-learn
Does enum have any effect on functions? Is this: mixin (Constant!(ln2)); package enum T ln2(T)(Context context) { return log(T.TWO, context, false); } different from this: mixin (Constant!(ln2)); package /*enum*/ T ln2(T)(Context context) { return log(T.TWO, context, false); }

Casting Structs

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
I'm working on the decimal number package for D. A decimal is a struct with precision, max exponent and rounding mode parameters: Decimal!(PRECISION, MAX_EXPO, ROUNDING). I was trying to overload the opCast operator for this struct and I found that it does not seem necessary. I can cast

Re: enums

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 31 May 2014 at 20:14:59 UTC, bearophile wrote: Miles Stoudenmire: In contrast to those two examples where immutable can be used at compile time, what are some other cases where it is necessary to use enum instead of immutable? By default use enum if you define a

Re: Casting Structs

2014-05-31 Thread Paul D Anderson via Digitalmars-d-learn
On Saturday, 31 May 2014 at 22:34:45 UTC, Timon Gehr wrote: On 06/01/2014 12:25 AM, Ali Çehreli wrote: dec10 little = cast(dec10(bingo)); You meant cast(dec10)(bingo). assert(little == dec10(123.45)); Is this expected behavior? Paul That is surprising. I've discovered that if the