Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread kdevel via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 03:36:47 UTC, Paul Backus wrote: On Tuesday, 5 January 2021 at 02:02:39 UTC, kdevel wrote: [...] If you try to call .toString directly on a const(S), you get the following error: onlineapp.d(27): Error: onlineapp.S.toString called with argument types () const

Re: D string to C struct fixed-size array

2021-01-04 Thread bdh via Digitalmars-d-learn
On Monday, 4 January 2021 at 18:05:40 UTC, tsbockman wrote: /* XXX: haven't done private members yet, wonder if they're needed to * complete this */ Leaving out the private members of a struct changes its size, and sometimes its alignment. This will definitely break things if you ever

Re: D string to C struct fixed-size array

2021-01-04 Thread bdh via Digitalmars-d-learn
On Monday, 4 January 2021 at 17:24:27 UTC, Steven Schveighoffer wrote: On 1/3/21 9:17 PM, bdh wrote: On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole wrote: Your definition of Image is probably wrong. You may have missed a pointer (8 bytes). [...] How to test: in D-land:

Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 5 January 2021 at 02:02:39 UTC, kdevel wrote: expected output: none. The compiler should have rejected the code after the duplicate definition def #2. dmd 2.093.1 ignores both definitions instead. Is this a bug or a bug? If you try to call .toString directly on a const(S), you get

Re: D string to C struct fixed-size array

2021-01-04 Thread bdh via Digitalmars-d-learn
On Monday, 4 January 2021 at 16:35:23 UTC, Jack wrote: Do you mean fill .filename member from a D string? something like this? [...] // since .filename isn't a pointer but an array, I think // you have to use memcpy() here. = operator wouldn't work properly. memcpy([0], [0],

dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-04 Thread kdevel via Digitalmars-d-learn
~~~tsnf.d import std.stdio: writeln; struct S { string s; string toString () { return __PRETTY_FUNCTION__ ~ `: ` ~ s; } string toString () const // def #1 { return __PRETTY_FUNCTION__ ~ `: ` ~ s; } const string toString () // def #2 { return

Conflict when using stderr with import.

2021-01-04 Thread Paul via Digitalmars-d-learn
I'm trying to use stderr.writefln, while using the 'bindbc-opengl' package, but when I try to I get the message: source\app.d(13,2): Error: function std.stdio.makeGlobal!"core.stdc.stdio.stderr".makeGlobal at C:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(4853,20) conflicts with variable

Re: D string to C struct fixed-size array

2021-01-04 Thread tsbockman via Digitalmars-d-learn
On Monday, 4 January 2021 at 02:17:33 UTC, bdh wrote: I'm pretty sure it's correct? Here's the D version: https://repo.or.cz/magickd.git/blob/e5d06e939:/source/magickd/core/c/image.d#l751 Here's the C version:

Re: DConf talk : Exceptions will disappear in the future?

2021-01-04 Thread Ali Çehreli via Digitalmars-d-learn
On 1/4/21 7:39 AM, ludo456 wrote: > Can someone point me to an article or more explanations about that? Joe Duffy has a very complete document contrasting various error management strategies in the context of Midori: http://joeduffyblog.com/2016/02/07/the-error-model/ Herb Sutter has a

Re: DConf talk : Exceptions will disappear in the future?

2021-01-04 Thread oddp via Digitalmars-d-learn
On 04.01.21 16:39, ludo456 via Digitalmars-d-learn wrote: Can someone point me to an article or more explanations about that? already came up, see: https://forum.dlang.org/thread/jnrvugxqjzenykztt...@forum.dlang.org https://forum.dlang.org/thread/lhyagawrjzzmrtbok...@forum.dlang.org

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/4/21 12:17 PM, Steven Schveighoffer wrote: If you want a few seconds *wait* a few seconds -Steve

Re: D string to C struct fixed-size array

2021-01-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/3/21 9:17 PM, bdh wrote: On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole wrote: Your definition of Image is probably wrong. You may have missed a pointer (8 bytes). I'm pretty sure it's correct? Here's the D version:

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/3/21 6:53 PM, aberba wrote: On Friday, 1 January 2021 at 22:07:28 UTC, Selim Ozel wrote: I created the simplest possible example as explained by the Vibe-D community in [1]. The exact source code of what I run is in [2]. On Windows I get a socket handle leak warning on shutdown with

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/2/21 12:52 PM, Selim Ozel wrote: After logging into to 127.0.0.1 for a single time in my browser, if I do a ctrl+c it still leaks two socket handles. With connection Windows 10: Running .\vibe_noleaks.exe [main() INF] Listening for requests on http://[::1]:8080/ [main() INF]

Re: D string to C struct fixed-size array

2021-01-04 Thread Jack via Digitalmars-d-learn
On Sunday, 3 January 2021 at 08:43:34 UTC, bdh wrote: Hi, I'm trying to create bindings to the GraphcicsMagick C library which has the following struct defined: [...] Do you mean fill .filename member from a D string? something like this? import std.stdio; [...] struct Image

DConf talk : Exceptions will disappear in the future?

2021-01-04 Thread ludo456 via Digitalmars-d-learn
Listening to the first visioconf of the Dconf 2020, titled Destroy All Memory Corruption, (https://www.youtube.com/watch?v=XQHAIglE9CU) Walter talks about not using exceptions any more in the future. He says something like "this is where languages are going" [towards no using exceptions any