Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Venkat via Digitalmars-d-learn
TY Mike, that explains it. Thanks Ivan.

Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Ivan Trombley via Digitalmars-d-learn
On Sunday, 17 December 2017 at 02:42:44 UTC, Venkat wrote: dub build --vverbose That is the command I used. Would it be right to assume that -g is being added because --vverbose ? The reason I ask is the file size is about the same when I run the below command. dub build You need to add "-

Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 17 December 2017 at 02:42:44 UTC, Venkat wrote: dub build --vverbose That is the command I used. Would it be right to assume that -g is being added because --vverbose ? The reason I ask is the file size is about the same when I run the below command. dub build It's because debug

Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Venkat via Digitalmars-d-learn
dub build --vverbose That is the command I used. Would it be right to assume that -g is being added because --vverbose ? The reason I ask is the file size is about the same when I run the below command. dub build

Re: Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, December 17, 2017 02:08:00 Venkat via Digitalmars-d-learn wrote: > The following is the command output by dub with --vverbose > switch. It generates a file which is 6094400 bytes in size > > dmd -lib > -of.dub/build/library-debug-linux.posix-x86_64-dmd_2077-7BB682AB55F152616E > 128DD715E

OT: s/crush/crash/g

2017-12-16 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2017 12:51 PM, kerdemdemir wrote: > I am getting a crush while calling requestHTTP > function : That sounds like "having a crush", which happens to me too but I think you meant "crash". :o) Ali

Dub generates a library file that is larger in size than the one built on command line.

2017-12-16 Thread Venkat via Digitalmars-d-learn
The following is the command output by dub with --vverbose switch. It generates a file which is 6094400 bytes in size dmd -lib -of.dub/build/library-debug-linux.posix-x86_64-dmd_2077-7BB682AB55F152616E128DD715E887DF/libdjni.a -debug -g -w -version=Have_djni -Isource/ source/app.d source/jni/J

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-16 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2017 05:21 PM, Unazed Spectaculum wrote: > 1) Starting program > unazed@unazed  /home/d/storage-server  dmd -debug -run app.d Although I don't normally use the -run switch, as expected, it works with -run as well. (More below.) > Listening: 0.0.0.0:6969 > > 2) telnet to the server

Dub generate import files

2017-12-16 Thread Venkat via Digitalmars-d-learn
dmd has the -H and -Hd switches. Does dub have any setting to make it generate D interface files ?

Re: `Socket.receive` providing arbitrary packet sizes and hanging without sending EOF

2017-12-16 Thread Unazed Spectaculum via Digitalmars-d-learn
On Thursday, 14 December 2017 at 20:27:36 UTC, Ali Çehreli wrote: On 12/14/2017 11:55 AM, Unazed Spectaculum wrote: This is the only function which has a call to `receiveAll` I marked my changes with [Ali]: import std.stdio; import std.socket; import std.conv; import std.json; ubyte[] rece

Re: Dynamic Array reserve

2017-12-16 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2017 03:58 PM, Steven Schveighoffer wrote: I think you are fine to just use Array and not worry about the reallocations, they are handled automatically. -Steve I was going to suggest the same to Vino and I was writing the following program to demonstrate how low the number of alloc

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, December 17, 2017 00:10:27 Anonymouse via Digitalmars-d-learn wrote: > On Saturday, 16 December 2017 at 21:56:49 UTC, Jonathan M Davis > > wrote: > > The only way to catch an exception is with a catch block, and > > if you do > > If you return inside a scopeguard though, the exception (

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 December 2017 at 21:56:49 UTC, Jonathan M Davis wrote: The only way to catch an exception is with a catch block, and if you do If you return inside a scopeguard though, the exception (or error!) is swallowed. https://run.dlang.io/is/GEtQ6D void main() { foo(); writeln

Re: Dynamic Array reserve

2017-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/16/17 5:48 PM, Vino wrote: On Saturday, 16 December 2017 at 16:46:49 UTC, Jacob Carlborg wrote: On 2017-12-16 15:11, Vino wrote: Hi All,   Request your help on reserve an dynamic array when the capacity is reached to a point(eg: 80%) so the array to extend the reserve by next 20% Exa

Re: Dynamic Array reserve

2017-12-16 Thread Vino via Digitalmars-d-learn
On Saturday, 16 December 2017 at 16:46:49 UTC, Jacob Carlborg wrote: On 2017-12-16 15:11, Vino wrote: Hi All,  Request your help on reserve an dynamic array when the capacity is reached to a point(eg: 80%) so the array to extend the reserve by next 20% Example: Array!string Test; Test. res

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Basile B. via Digitalmars-d-learn
On Saturday, 16 December 2017 at 21:11:43 UTC, Marc wrote: On Saturday, 16 December 2017 at 20:05:15 UTC, Anonymouse wrote: On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 16, 2017 21:22:47 kerdemdemir via Digitalmars-d-learn wrote: > On Saturday, 16 December 2017 at 20:56:26 UTC, ketmar wrote: > > kerdemdemir wrote: > >> As far as I know scope(failure) should be collecting all > >> failure cases. > > > > nope. `failure` scope won't stop except

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 16, 2017 21:11:43 Marc via Digitalmars-d-learn wrote: > On Saturday, 16 December 2017 at 20:05:15 UTC, Anonymouse wrote: > > On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: > >> C# has a quite nice way to store metadata about a property by > >> a feature called atri

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread ketmar via Digitalmars-d-learn
kerdemdemir wrote: On Saturday, 16 December 2017 at 20:56:26 UTC, ketmar wrote: kerdemdemir wrote: As far as I know scope(failure) should be collecting all failure cases. nope. `failure` scope won't stop exception propagation, it is just called before exception leaves your function, to giv

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread kerdemdemir via Digitalmars-d-learn
On Saturday, 16 December 2017 at 20:56:26 UTC, ketmar wrote: kerdemdemir wrote: As far as I know scope(failure) should be collecting all failure cases. nope. `failure` scope won't stop exception propagation, it is just called before exception leaves your function, to give you a last chance

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Marc via Digitalmars-d-learn
On Saturday, 16 December 2017 at 20:05:15 UTC, Anonymouse wrote: On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can write something like this: class A { [TextSize(256)]

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread ketmar via Digitalmars-d-learn
kerdemdemir wrote: As far as I know scope(failure) should be collecting all failure cases. nope. `failure` scope won't stop exception propagation, it is just called before exception leaves your function, to give you a last chance to do some immediate cleanup.

Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-16 Thread kerdemdemir via Digitalmars-d-learn
While calling this function : bool PublicMarketCall( ref Json result ) { string fullUrl = "https://bittrex.com/api/v1.1/public/getmarketsummaries";; Json data; try { requestHTTP(fullUrl, (scope req) { req.method = HTTPMethod.GET;

Re: Does D have class' attributes like C#'s?

2017-12-16 Thread Anonymouse via Digitalmars-d-learn
On Saturday, 16 December 2017 at 19:57:30 UTC, Marc wrote: C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can write something like this: class A { [TextSize(256)] string Name { get; set; } } So using runtime/reflection I can

Does D have class' attributes like C#'s?

2017-12-16 Thread Marc via Digitalmars-d-learn
C# has a quite nice way to store metadata about a property by a feature called atributes[1]. For example, I can write something like this: class A { [TextSize(256)] string Name { get; set; } } So using runtime/reflection I can retrieve the TextSize value associated to A.name property.

Re: get only user-defined members

2017-12-16 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, December 16, 2017 15:28:46 Marc via Digitalmars-d-learn wrote: > On Saturday, 16 December 2017 at 07:23:38 UTC, Jonathan M Davis > > wrote: > > On Saturday, December 16, 2017 04:01:10 Marc via > > > > Digitalmars-d-learn wrote: > >> how do I from class: > >> > class Person { > >> > > >

Re: Dynamic Array reserve

2017-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-16 15:11, Vino wrote: Hi All,  Request your help on reserve an dynamic array when the capacity is reached to a point(eg: 80%) so the array to extend the reserve by next 20% Example: Array!string Test; Test. reserve(100) - Initall Test =(.) - The number of entries are dynam

Re: how do I read a class member's value using traits?

2017-12-16 Thread Marc via Digitalmars-d-learn
On Saturday, 16 December 2017 at 03:48:01 UTC, Jonathan M Davis wrote: On Saturday, December 16, 2017 03:34:43 Marc via Digitalmars-d-learn wrote: I need to give a class C, read all user-defined members of it, both name and value dynamically. for example: > [...] then >[...] I get this error

Re: get only user-defined members

2017-12-16 Thread Marc via Digitalmars-d-learn
On Saturday, 16 December 2017 at 07:23:38 UTC, Jonathan M Davis wrote: On Saturday, December 16, 2017 04:01:10 Marc via Digitalmars-d-learn wrote: how do I from class: > class Person { > > string name; > int age; > > } do: > auto c = [__traits(allMembers, Person)]; then return only ["name",

Re: Array Template

2017-12-16 Thread Vino via Digitalmars-d-learn
On Saturday, 16 December 2017 at 06:42:53 UTC, codephantom wrote: On Friday, 15 December 2017 at 17:21:55 UTC, Vino wrote: Hi All, Request your help, Is it possible to an template array something similar as below so that we can insert any type of value(string, int etc). If possible can you

Dynamic Array reserve

2017-12-16 Thread Vino via Digitalmars-d-learn
Hi All, Request your help on reserve an dynamic array when the capacity is reached to a point(eg: 80%) so the array to extend the reserve by next 20% Example: Array!string Test; Test. reserve(100) - Initall Test =(.) - The number of entries are dynamic if (array.capacity > 80%) { arr

Re: weird exception on windows

2017-12-16 Thread Vino via Digitalmars-d-learn
On Saturday, 16 December 2017 at 13:59:11 UTC, Vino wrote: On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Tha

Re: weird exception on windows

2017-12-16 Thread Vino via Digitalmars-d-learn
On Saturday, 16 December 2017 at 12:39:53 UTC, Kagamin wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, ca

Defining an Array

2017-12-16 Thread Vino via Digitalmars-d-learn
Hi All, Request your help for the below as how do i add an item to a array in the array is defined as Type 2. Type 1: Working import std.conatiner.array; void main () { auto PStore = Array!(string)("Test1", "Test1") } Type 2: not working import std.conatiner.array; void main () { Array!(s

Re: weird exception on windows

2017-12-16 Thread Kagamin via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issu

Re: Pass D const pointer to opaque C library: Guarantees? Optimization-safe?

2017-12-16 Thread SimonN via Digitalmars-d-learn
On Saturday, 16 December 2017 at 11:19:36 UTC, Mike Parker wrote: that's a binding, not a wrapper. Right! Not sure what you mean by "safe" you only want to prevent changes on the D side and don't care if they happen on the C side, then that's fine. This, yes. I'd like const-annotated D code

Re: Alias!T

2017-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/16/17 6:45 AM, bauss wrote: In what scenario would you use Alias!T from std.meta? I understand what it does and how it can be used, but I can't seem to think of a reasonable situation where it's desirable. https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing

Re: weird exception on windows

2017-12-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/16/17 5:12 AM, bauss wrote: On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into

Alias!T

2017-12-16 Thread bauss via Digitalmars-d-learn
In what scenario would you use Alias!T from std.meta? I understand what it does and how it can be used, but I can't seem to think of a reasonable situation where it's desirable.

Re: Pass D const pointer to opaque C library: Guarantees? Optimization-safe?

2017-12-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 December 2017 at 11:19:36 UTC, Mike Parker wrote: I would expect SiegeLord to reject such a PR. And now that I clicked through the link, I see I was wrong :-) In principle, I disagree with him because of what I mentioned above about immutable variables. In practice, it's prob

Re: Pass D const pointer to opaque C library: Guarantees? Optimization-safe?

2017-12-16 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 16 December 2017 at 08:56:59 UTC, SimonN wrote: Hi, I'm calling a C library through a D wrapper. The situation is like this: C library has: struct A { ... }; A* create_a() { ... } void foo(A*) { ... } D wrapper declares: extern (C) { struct A {}

Re: weird exception on windows

2017-12-16 Thread bauss via Digitalmars-d-learn
On Saturday, 16 December 2017 at 08:07:30 UTC, Szabo Bogdan wrote: On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szab

Re: Global variable type does not match previous declaration

2017-12-16 Thread Satoshi via Digitalmars-d-learn
On Saturday, 16 December 2017 at 09:04:05 UTC, Satoshi wrote: I commented out the TypeInfo declarations and got the same error but on different symbol. object.d(1569): Error: Function type does not match previously declared function with the same mangled name: _d_dynamic_cast https://github

Re: Global variable type does not match previous declaration

2017-12-16 Thread Satoshi via Digitalmars-d-learn
I commented out the TypeInfo declarations and got the same error but on different symbol. object.d(1569): Error: Function type does not match previously declared function with the same mangled name: _d_dynamic_cast https://github.com/Rikarin/Trinix/blob/master/Kernel/object.d#L1569 https://

Pass D const pointer to opaque C library: Guarantees? Optimization-safe?

2017-12-16 Thread SimonN via Digitalmars-d-learn
Hi, I'm calling a C library through a D wrapper. The situation is like this: C library has: struct A { ... }; A* create_a() { ... } void foo(A*) { ... } D wrapper declares: extern (C) { struct A {} A* create_a(); void foo(A*); } My D usercode

Re: weird exception on windows

2017-12-16 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 13:56:41 UTC, Kagamin wrote: You said tests fail? class SourceResult { private const { string file; size_t line; } this(string fileName = __FILE__, size_t line = __LINE__, size_t range = 6) nothrow

Re: weird exception on windows

2017-12-16 Thread Szabo Bogdan via Digitalmars-d-learn
On Friday, 15 December 2017 at 21:56:48 UTC, Steven Schveighoffer wrote: On 12/15/17 10:08 AM, Kagamin wrote: Maybe this https://issues.dlang.org/show_bug.cgi?id=18084 Thanks for looking into this. I created a PR to fix. Szabo, can you please try with this patch and see if it fixes your issu