Re: Using a macro for a function signature

2016-04-05 Thread pineapple via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 13:17:38 UTC, Anonymouse wrote: You can't get rid of the signature completely as the functions still need a parameter list with x declared. You will get "Error: undefined identifier 'x'" otherwise. You can largely omit the *type* of x if it can be inferred from the

Re: Using a macro for a function signature

2016-04-05 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 11:35:24 UTC, pineapple wrote: If I have a common function signature I'm using throughout my code, and I feel like there should be a way to condense it using a macro. The intuitive method isn't working, but this seems like something D would be able to do. What've I

Re: Using a macro for a function signature

2016-04-05 Thread ag0aep6g via Digitalmars-d-learn
On 05.04.2016 13:35, pineapple wrote: alias somelongsignature = int(in int x); alias somelongsignature = int function(in int); Or if you want to accept methods and such: alias somelongsignature = int delegate(in int); You can name the parameter, but it won't be part of the type. int

Get third part of front-end version number

2016-04-05 Thread Nick Sabalausky via Digitalmars-d-learn
These days, DMD/DMDFE version numbers are three parts, ex: 2.070.1. I can get the first two via std.compiler.version_major and std.compiler.version_minor. Is there a way to get the third part? I know I can "dmd --help | grep DMD", but that only works for DMD. GDC's "gdc --version" doesn't

Re: Get third part of front-end version number

2016-04-05 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:01:05 UTC, Nick Sabalausky wrote: These days, DMD/DMDFE version numbers are three parts, ex: 2.070.1. I can get the first two via std.compiler.version_major and std.compiler.version_minor. Is there a way to get the third part? I know I can "dmd --help | grep

Re: Convert wchar* to wstring?

2016-04-05 Thread Thalamus via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 11:26:44 UTC, Thalamus wrote: Thanks everyone! You've all been very helpful. For anyone who has the same question and happens on this thread, I wanted to post what I finally came up with. I combined the information everyone in this thread gave me with what I saw

Re: overriding methods

2016-04-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote: I had no error on the examples I posted, only when using @Override previously. It just says to use override attribute instead of @Override source\game\client.d(8,20): Deprecation: implicitly overriding base class method

Re: overriding methods

2016-04-05 Thread Ali Çehreli via Digitalmars-d-learn
On 04/05/2016 11:54 AM, stunaep wrote: > when using @Override previously. It just says to use override > attribute instead of @Override > source\game\client.d(7,3): Error: undefined identifier 'Override' Note that it doesn't say _instead of Override_. Override is an undefined symbol in your

Re: Decompressing bzip2

2016-04-05 Thread Charles Hixson via Digitalmars-d-learn
On 04/04/2016 04:38 PM, Mike Parker via Digitalmars-d-learn wrote: On Monday, 4 April 2016 at 21:32:10 UTC, stunaep wrote: Can you please explain what the scope keyword does and if there scope was originally intended to be used primarily with classes in order to get deterministic

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ? https://issues.dlang.org/show_bug.cgi?id=15880

overriding methods

2016-04-05 Thread stunaep via Digitalmars-d-learn
I get a deprecation warning with @Override, but I was unable to find the proper way to do it. Am I meant to add override before the method like this? override public void startThread(Thread t, int pri) { ... } Am I meant to wrap the entire method in override { } like this? override {

Re: overriding methods

2016-04-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote: I get a deprecation warning with @Override, but I was unable to find the proper way to do it. What error message exactly are you getting and on what code? Both styles you put there should work equally well.

Re: Convert wchar* to wstring?

2016-04-05 Thread ag0aep6g via Digitalmars-d-learn
On 05.04.2016 20:44, Thalamus wrote: import core.stdc.stddef; // For wchar_t. This is defined differently for Windows vs POSIX. import core.stdc.wchar_; // For wcslen. Aside: D has syntax for "// For wchar_t.": `import core.stdc.stddef: wchar_t;`. wstring toWstring(wchar_t* value) {

Re: overriding methods

2016-04-05 Thread stunaep via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:42:33 UTC, Adam D. Ruppe wrote: On Tuesday, 5 April 2016 at 18:38:43 UTC, stunaep wrote: I get a deprecation warning with @Override, but I was unable to find the proper way to do it. What error message exactly are you getting and on what code? Both styles you

Re: overriding methods

2016-04-05 Thread pineapple via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 18:54:39 UTC, stunaep wrote: I had no error on the examples I posted, only when using @Override previously. It just says to use override attribute instead of @Override Unlike in Java, D's override indicator doesn't look like an annotation, it's just a keyword

What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ?

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 21:10:47 UTC, Basile B. wrote: On Tuesday, 5 April 2016 at 20:56:54 UTC, Alex Parrill wrote: On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ? It's potentially ambiguous with hexadecimal floating point numbers 0xdeadbeef.p5 // hex float or hex int + method?

Re: What's the rationale for considering "0x1.max" as invalid ?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 20:56:54 UTC, Alex Parrill wrote: On Tuesday, 5 April 2016 at 19:00:43 UTC, Basile B. wrote: 0x1.max // exponent expected in hex float 0x1 .max // OK 1.max // OK What's the ambiguity when it's an hex literal ? It's potentially ambiguous with hexadecimal floating

Re: Decompressing bzip2

2016-04-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 19:27:20 UTC, Charles Hixson wrote: ... Are you asserting that scope is soon to be officially deprecated? I'm finding "shouldn't really be used at all anymore" a bit of a worrying statement, as I much prefer the syntax used by scope. Why shouldn't it "be used at

Re: Convert wchar* to wstring?

2016-04-05 Thread Thalamus via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 19:19:10 UTC, ag0aep6g wrote: On 05.04.2016 20:44, Thalamus wrote: [...] Aside: D has syntax for "// For wchar_t.": `import core.stdc.stddef: wchar_t;`. [...] wchar_t is not wchar. wstring is not (portably) compatible with a wchar_t array. If you actually

Re: Decompressing bzip2

2016-04-05 Thread Charles Hixson via Digitalmars-d-learn
On 04/05/2016 03:33 PM, Mike Parker via Digitalmars-d-learn wrote: On Tuesday, 5 April 2016 at 19:27:20 UTC, Charles Hixson wrote: ... Are you asserting that scope is soon to be officially deprecated? I'm finding "shouldn't really be used at all anymore" a bit of a worrying statement, as I

PostgreSQL. Unknown parameter of configuration : "autocommit"

2016-04-05 Thread Suliman via Digitalmars-d-learn
Is there anybody who have success connect to PostgreSQL with ddbc? I am getting next error: https://github.com/buggins/ddbc/issues/22

Re: Convert wchar* to wstring?

2016-04-05 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote: I'm sorry for this total newbie question, but for some reason this is eluding me. [...] You've been given the right answer by the other participants but I'd like to share this simple helper range from my user lib: auto

Re: Convert wchar* to wstring?

2016-04-05 Thread Rene Zwanenburg via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote: I'm sorry for this total newbie question, but for some reason this is eluding me. I must be overlooking something obvious, but I haven't been able to figure this out and haven't found anything helpful. In case you haven't done so

Re: Convert wchar* to wstring?

2016-04-05 Thread tsbockman via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote: When the message parameter is wchar*, wstring info = to!wstring(message) populates the string with the _address_ of the wchar*. So when message was in the debugger as 0x035370e8 L"Writing Exhaustive unit tests is exhausting.",

Segmentation Fault on rt.tlsgc.init

2016-04-05 Thread tcak via Digitalmars-d-learn
If I create many threads (starts, does a short work, and ends) repeatedly (>10,000), at some point rt.tlsgc.init() gives SEGMENTATION_FAULT. It doesn't check whether malloc fails to allocate any memory, and I cannot find the source code of "rt.sections.initTLSRanges()" anywhere. Is it left

Re: PostgreSQL. Unknown parameter of configuration : "autocommit"

2016-04-05 Thread Suliman via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 07:53:20 UTC, Suliman wrote: Is there anybody who have success connect to PostgreSQL with ddbc? I am getting next error: https://github.com/buggins/ddbc/issues/22 Look like driver do not support PG 9.5 http://www.symmetricds.org/issues/view.php?id=2439

Using a macro for a function signature

2016-04-05 Thread pineapple via Digitalmars-d-learn
If I have a common function signature I'm using throughout my code, and I feel like there should be a way to condense it using a macro. The intuitive method isn't working, but this seems like something D would be able to do. What've I got wrong in this example? alias somelongsignature =

Re: Using a macro for a function signature

2016-04-05 Thread pineapple via Digitalmars-d-learn
Ah, aside from the mismatched "examplefunc" numbers - please disregard Can't post example code without stupid typos for the life of me

Re: Convert wchar* to wstring?

2016-04-05 Thread Thalamus via Digitalmars-d-learn
Thanks everyone! You've all been very helpful.

Re: Segmentation Fault on rt.tlsgc.init

2016-04-05 Thread Jacob Carlborg via Digitalmars-d-learn
On 2016-04-05 11:46, tcak wrote: If I create many threads (starts, does a short work, and ends) repeatedly (>10,000), at some point rt.tlsgc.init() gives SEGMENTATION_FAULT. It doesn't check whether malloc fails to allocate any memory, and I cannot find the source code of

Re: Convert wchar* to wstring?

2016-04-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 07:10:50 UTC, tsbockman wrote: You can also combine both steps into a one-liner: wstring wstr = cw[0 .. cw_len].idup; This should do the trick, too: import std.conv : to; auto wstr = to!wstring(cw);

Re: Convert wchar* to wstring?

2016-04-05 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 01:21:55 UTC, Thalamus wrote: I am invoking an entry point in a D DLL from C# (via extern (C)), and one of the parameters is a string. This works just fine for ANSI, but I'm having trouble with the Unicode equivalent. When the message parameter is wchar*, wstring

Re: PostgreSQL. Unknown parameter of configuration : "autocommit"

2016-04-05 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 5 April 2016 at 10:30:58 UTC, Suliman wrote: http://www.symmetricds.org/issues/view.php?id=2439 http://www.postgresql.org/docs/9.5/static/ecpg-sql-set-autocommit.html - doesn't look deprecated or anything.