Re: SegFault with HibernateD

2018-01-12 Thread Ali Çehreli via Digitalmars-d-learn
On 01/12/2018 06:50 PM, Venkat wrote: > Sorry about all these posts. Wish there were an edit button. That's ok. :) These are actually newsgroups (see NNTP protocol). Newsgroups don't have any edit functionality. The "forum" is just a web interface to newsgroups. Ali

Re: Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
Going beyond the connection, there are various other libpq functions that use a similar pattern of values passed using multiple parallel C arrays, e.g., PGresult *PQexecParams(PGconn *conn, const char *command, int nParams,

Re: Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 04:26:06 UTC, Adam D. Ruppe wrote: If and only if the values are known at compile time, you can do: const char** keywords = ["hostaddr".ptr, "port".ptr, "dbname".ptr, null].ptr; or even do it inline: PQconnectdbParams(["hostaddr".ptr, "port".ptr,

Re: Using Postgres connection functions

2018-01-12 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 13 January 2018 at 04:17:02 UTC, Joe wrote: It only compiled after I removed the second 'const' in the first and second arguments. Yeah, D's const applies down the chain automatically, so you don't write it twice there. string[] keywords = ["hostaddr", "port", "dbname"];

Using Postgres connection functions

2018-01-12 Thread Joe via Digitalmars-d-learn
I'm trying to learn how to use D to connect (and send queries) to Postgres, i.e., libpq in C. Postgres has three families of connection functions: PQsetdbLogin which takes multiple individual arguments (all as const char *), PQconnectdb which takes a single connection string (which Postgres

Re: continue in static foreach

2018-01-12 Thread Seb via Digitalmars-d-learn
On Saturday, 13 January 2018 at 01:07:24 UTC, Marc wrote: On Friday, 12 January 2018 at 22:03:53 UTC, H. S. Teoh wrote: On Fri, Jan 12, 2018 at 10:03:40PM +, Marc via Digitalmars-d-learn wrote: How do I use? > static foreach(enum string member; members) { >static

Re: SegFault with HibernateD

2018-01-12 Thread Venkat via Digitalmars-d-learn
Sorry about all these posts. Wish there were an edit button. I meant PreparedStatement in mysqlddbc driver, not HibernateD.

Re: SegFault with HibernateD

2018-01-12 Thread Venkat via Digitalmars-d-learn
I think there is a bug with PreparedStatement class in HibernateD. ddbc fails when I use a PreparedStatement. The code below shows that. I will create an issue with HibernateD. int main(string[] args) { string url = "mysql://localhost:3306/webmarx?user=webmarx_dev,password=webm@rx";

Re: continue in static foreach

2018-01-12 Thread Marc via Digitalmars-d-learn
On Friday, 12 January 2018 at 22:03:53 UTC, H. S. Teoh wrote: On Fri, Jan 12, 2018 at 10:03:40PM +, Marc via Digitalmars-d-learn wrote: How do I use? > static foreach(enum string member; members) { >static if(isFunction!(__traits(getMember, C, member))) { >

Re: SegFault with HibernateD

2018-01-12 Thread Venkat via Digitalmars-d-learn
On Friday, 12 January 2018 at 08:55:13 UTC, Rene Zwanenburg wrote: Hard to guess what the issue is, I'd attach a debugger to see where it crashes. It fails at the sql() method in Command struct in mysql-native-1.1.4/mysql-native/source/mysql/commands.d. This is what gdb says when I do a disp

Re: SegFault with HibernateD

2018-01-12 Thread Venkat via Digitalmars-d-learn
On Friday, 12 January 2018 at 12:41:34 UTC, Mike Parker wrote: I see now. I glossed right over that execution output. On Windows, I don't recall ever seeing a dub exception from dub from a segfault. Just checked by accessing a null pointer and there's nothing thrown from dub. Is that a Linux

Re: continue in static foreach

2018-01-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 12, 2018 at 10:03:40PM +, Marc via Digitalmars-d-learn wrote: > How do I use? > > > static foreach(enum string member; members) { > > static if(isFunction!(__traits(getMember, C, member))) { > > continue; > > } >

continue in static foreach

2018-01-12 Thread Marc via Digitalmars-d-learn
How do I use? static foreach(enum string member; members) { static if(isFunction!(__traits(getMember, C, m ember))) { continue; } give error: must use labeled continue within static foreach then I tried:

Re: How to move an associative array between modules?

2018-01-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 12, 2018 at 08:46:50PM +, WhatMeWorry via Digitalmars-d-learn wrote: [...] > I hate to keep being a bother, but my project with the below static > this() now compiles fine, but aborts during runtime with a "a problem > caused the program to stop working ..." Is there a way to get

Re: How to move an associative array between modules?

2018-01-12 Thread WhatMeWorry via Digitalmars-d-learn
On Thursday, 11 January 2018 at 23:29:30 UTC, Adam D. Ruppe wrote: On Thursday, 11 January 2018 at 23:20:44 UTC, WhatMeWorry wrote: When I simply move the array out of main() but still in app.d, the compiler returns Error: expression ["SCRATCH":Track("scratch.wav", cast(Sound)1, 0, null),...

Re: union/toString: crash/segfault: What's happening here?

2018-01-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 12, 2018 at 10:49:45AM -0800, H. S. Teoh via Digitalmars-d-learn wrote: > On Fri, Jan 12, 2018 at 11:09:47AM +, kdevel via Digitalmars-d-learn > wrote: > [...] [...] > > https://issues.dlang.org/show_bug.cgi?id=18232 > > Yep, definitely a codegen bug. Apparently, local

Re: Why is this valued zeroed?

2018-01-12 Thread Marc via Digitalmars-d-learn
On Friday, 12 January 2018 at 05:14:12 UTC, Jonathan M Davis wrote: On Thursday, January 11, 2018 14:07:18 Ali Çehreli via Digitalmars-d-learn wrote: [...] And if all what you're doing is printing the value out, you might as well just print the Duration directly rather than calling total.

Re: union/toString: crash/segfault: What's happening here?

2018-01-12 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Jan 12, 2018 at 11:09:47AM +, kdevel via Digitalmars-d-learn wrote: [...] > On Friday, 12 January 2018 at 02:16:39 UTC, Adam D. Ruppe wrote: [...] > > I'd file this as a compiler codegen bug. > > https://issues.dlang.org/show_bug.cgi?id=18232 Yep, definitely a codegen bug.

Re: Possible dmd 2.078 regression ?

2018-01-12 Thread Basile B. via Digitalmars-d-learn
On Friday, 12 January 2018 at 18:50:10 UTC, Basile B. wrote: On Friday, 12 January 2018 at 17:58:30 UTC, Stefan Koch wrote: On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It

Re: Possible dmd 2.078 regression ?

2018-01-12 Thread Stefan Koch via Digitalmars-d-learn
On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote: I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worked fine before. Please test this --- if [ ! -d "iz" ]; then git clone https://www.github.com/BBasile/iz.git fi cd

Re: invalid or corrupt file: duplicate COMDAT / Previous Definition Different

2018-01-12 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 10 January 2018 at 20:53:24 UTC, Anonymouse wrote: None of the (version specifiers in the) build configurations I have touch upon the part of the fairly innocent code mentioned in the error message, if I'm reading it right.

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread Seb via Digitalmars-d-learn
On Friday, 12 January 2018 at 13:04:30 UTC, aliak wrote: On Friday, 12 January 2018 at 10:55:53 UTC, Seb wrote: On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote: Hi, so basically is there a way to: void func(alias pred = null, Range)(Range range) { // 1) check if

Possible dmd 2.078 regression ?

2018-01-12 Thread Basile B. via Digitalmars-d-learn
I have a simple program that only compiles if the dependency is not pre-compiled as a static library. It worked fine before. Please test this --- if [ ! -d "iz" ]; then git clone https://www.github.com/BBasile/iz.git fi cd iz/scripts sh compile.sh cd ../ #fails to link dmd

Re: Floating Point Literals: float (f) and real (L) suffix issue

2018-01-12 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 12 January 2018 at 12:57:37 UTC, kdevel wrote: On Friday, 12 January 2018 at 12:45:59 UTC, kdevel wrote: suffix.d ``` void main () { real r = 1.L; float f = 1.f; } ``` $ dmd suffix.d suffix.d(3): Error: no property 'L' for type 'int' suffix.d(4): Error: no property 'f' for

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread aliak via Digitalmars-d-learn
On Friday, 12 January 2018 at 10:55:53 UTC, Seb wrote: On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote: Hi, so basically is there a way to: void func(alias pred = null, Range)(Range range) { // 1) check if pred(ElementType!Range.init, ElementType!Range.init) is equality // 2)

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread aliak via Digitalmars-d-learn
On Friday, 12 January 2018 at 08:18:02 UTC, Simen Kjærås wrote: On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote: Hi, so basically is there a way to: void func(alias pred = null, Range)(Range range) { // 1) check if pred(ElementType!Range.init, ElementType!Range.init) is equality

Re: Floating Point Literals: float (f) and real (L) suffix issue

2018-01-12 Thread kdevel via Digitalmars-d-learn
On Friday, 12 January 2018 at 12:45:59 UTC, kdevel wrote: suffix.d ``` void main () { real r = 1.L; float f = 1.f; } ``` $ dmd suffix.d suffix.d(3): Error: no property 'L' for type 'int' suffix.d(4): Error: no property 'f' for type 'int' According to the grammar in

Floating Point Literals: float (f) and real (L) suffix issue

2018-01-12 Thread kdevel via Digitalmars-d-learn
suffix.d ``` void main () { real r = 1.L; float f = 1.f; } ``` $ dmd suffix.d suffix.d(3): Error: no property 'L' for type 'int' suffix.d(4): Error: no property 'f' for type 'int' According to the grammar in dmd2/html/d/spec/lex.html both are valid FloatLiterals. Any comments?

Re: SegFault with HibernateD

2018-01-12 Thread Mike Parker via Digitalmars-d-learn
On Friday, 12 January 2018 at 08:55:13 UTC, Rene Zwanenburg wrote: It looks to me like the program is being run through dub, and dub is just reporting the program's exit code. I see now. I glossed right over that execution output. On Windows, I don't recall ever seeing a dub exception

Re: Is old style compile-time foreach redundant?

2018-01-12 Thread Seb via Digitalmars-d-learn
On Sunday, 7 January 2018 at 02:17:02 UTC, Stefan Koch wrote: On Sunday, 7 January 2018 at 01:08:44 UTC, H. S. Teoh wrote: On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via Digitalmars-d-learn wrote: On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote: > Is 'static foreach'

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread cuxu via Digitalmars-d-learn
мinterest Ask. our service https://reviews-up.com/android-app-reviews/ with the help of specialists will help you in promoting your application and solving this issue

Re: union/toString: crash/segfault: What's happening here?

2018-01-12 Thread kdevel via Digitalmars-d-learn
Thanks for the quick answer! On Friday, 12 January 2018 at 02:16:39 UTC, Adam D. Ruppe wrote: On Friday, 12 January 2018 at 00:54:03 UTC, kdevel wrote: $ dmd crash.d $ ./crash Nicholas Wilson is right that you can use = "" to work around it, but with strings, null is supposed to behave the

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread Seb via Digitalmars-d-learn
On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote: Hi, so basically is there a way to: void func(alias pred = null, Range)(Range range) { // 1) check if pred(ElementType!Range.init, ElementType!Range.init) is equality // 2) check if isUnary!pred // 3) check if isBinary!pred }

Re: calloc for std.experimental.allocator

2018-01-12 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 11 January 2018 at 21:57:28 UTC, MrSmith wrote: http://dpldocs.info/experimental-docs/std.experimental.allocator.makeArray.4.html Thanks!

Re: SegFault with HibernateD

2018-01-12 Thread Rene Zwanenburg via Digitalmars-d-learn
On Friday, 12 January 2018 at 07:33:37 UTC, Mike Parker wrote: On Friday, 12 January 2018 at 05:24:52 UTC, Venkat wrote: I get a SegFault with the main method below which uses HibernateD . The second main method which uses ddbc just works fine. What is wrong with the first main method ? I have

Re: Can you introspect predicate arity and if it's an equality predicate?

2018-01-12 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 12 January 2018 at 00:16:07 UTC, aliak wrote: Hi, so basically is there a way to: void func(alias pred = null, Range)(Range range) { // 1) check if pred(ElementType!Range.init, ElementType!Range.init) is equality // 2) check if isUnary!pred // 3) check if isBinary!pred }