Re: Is there some kind of Blocking Queue for D?

2025-07-15 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 10 July 2025 at 23:57:48 UTC, Ali Çehreli wrote: On 7/10/25 7:28 AM, Bienlein wrote: > some blockinglist wrapper around slist I would try std.concurrency first because its message queue is a blocking queue anyway if you limit the size with setMaxMailboxSize(). I have some example

Re: Debugging on Windows

2025-04-25 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 16 April 2025 at 20:08:00 UTC, Arokh Slade wrote: Hello, I'm trying to get debugging on windows 10 to work. d_test.d ```D void main() { int i; } ``` I compile with: dmd -g -gf -m64 .\d_test.d I load the msvc debugger with devenv /DebugExe .\d_test.exe latest visualD insta

Re: Integer types

2024-10-08 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 8 October 2024 at 15:57:24 UTC, Jared McKinnan wrote: Hello there, Just wanted to ask if there's a real difference between e.g. the "long" type and "int_fast64_t" in terms of execution times. Thanks You need to specify your platform. In most cases, no, you won't see a differenc

Re: Hello dears, where I can deploy my vibe-d project? Someone know any hosting?

2024-10-03 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 3 October 2024 at 08:51:12 UTC, Danic wrote: I want to know where publish mi D web You can try Railway or Heroku for example. Or if you like Azure you could host it there as well. I've used Azure before and it's quite easy imo.

Using C header libs with importC

2024-09-18 Thread Imperatorn via Digitalmars-d-learn
https://forum.dlang.org/post/qpmqvhipfyyyehvoe...@forum.dlang.org On Monday, 8 January 2024 at 23:00:02 UTC, Dennis wrote: On Monday, 8 January 2024 at 21:56:10 UTC, Renato wrote: but I tried exactly that! Which gives a seg fault. Looks like there's a bug with the -H switch: https://issues.dl

Re: Recommendations on porting Python to D

2024-07-12 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: I can just call my old C code from D, but the old Python is another story. Thanks for any advice you may have, You could also try some AI solution

Re: D is nice whats really wrong with gc??

2023-12-20 Thread Imperatorn via Digitalmars-d-learn
On Monday, 18 December 2023 at 17:22:22 UTC, H. S. Teoh wrote: On Mon, Dec 18, 2023 at 04:44:11PM +, Bkoie via Digitalmars-d-learn wrote: [...] but what is with these ppl and the gc? [...] It's called GC phobia, a knee-jerk reaction malady common among C/C++ programmers (I'm one of them,

Re: D: How to check if a function is chained? a().b().c();

2023-11-18 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 18 November 2023 at 07:47:19 UTC, BoQsc wrote: Let's say we have a chain of functions. ``` a().b().c(); ``` I would like to have a behaviour in `a()` that would check if there is `b()` or `c()` chained to it. If `a();`is not chained: do a `writeln("You forgot to chain this fun

Re: How should class objects created in betterC be destroyed

2023-11-05 Thread Imperatorn via Digitalmars-d-learn
On Monday, 6 November 2023 at 05:30:02 UTC, zoe wrote: I customized object.d in -betterc mode and created NEW templates, with modules I can seemingly create classes without extern(C++) mode, and type conversions in function calls seem to work fine. But when destroy doesn't find a way to call th

Re: DUB: Sometimes generates .di file and sometimes do not.

2023-11-05 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 5 November 2023 at 10:53:33 UTC, BoQsc wrote: I would like to know how to solve this problem with `dub`. **dub.sdl** ``` name "dheaders" description "generates .di header file for a static library." authors "public domain" copyright "Public Domain. No rights reserved." license "publi

Re: win32 api & lib issue

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 18:30:41 UTC, Imperatorn wrote: On Friday, 3 November 2023 at 00:57:30 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just

Re: win32 api & lib issue

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:57:30 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just do "dub add dfl". In Entice designer you can then change your co

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 14:33:56 UTC, Basile B. wrote: On Saturday, 4 November 2023 at 13:51:20 UTC, Dadoum wrote: [...] The type simply cannot be mangled using the C++ mangler as it does not exist over there. You might have the impression that this should be allowed, e.g as an exte

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 11:18:02 UTC, Dadoum wrote: On Saturday, 4 November 2023 at 10:08:20 UTC, Imperatorn wrote: On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage, it'

Re: Why can't we use strings in C++ methods?

2023-11-04 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 4 November 2023 at 03:00:49 UTC, Dadoum wrote: I was wondering why C++ linkage forbids strings as arguments while we can with the C one. With C linkage, it's translated to a template that's defined in the automatically generated header, but it just doesn't compile in C++. Can y

Re: performance issues with SIMD function

2023-11-03 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:17:43 UTC, Imperatorn wrote: On Friday, 3 November 2023 at 15:11:31 UTC, Bogdan wrote: Hi everyone, I was playing around with the intel-intrinsics library, trying to improve the speed of a simple area function. I could not see any performance improvements from

Re: performance issues with SIMD function

2023-11-03 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:11:31 UTC, Bogdan wrote: Hi everyone, I was playing around with the intel-intrinsics library, trying to improve the speed of a simple area function. I could not see any performance improvements from the non-SIMD implementation. The SIMD version is a little bit

Re: why remove octal literal support?

2023-11-03 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 15:07:41 UTC, d007 wrote: dlang is know for compile speed, but in reality d project compile slow because so much ctfe and tempalte. Why bring more ctfe call by remmove octal literal ? What are you even saying?

Re: win32 api & lib issue

2023-11-03 Thread Imperatorn via Digitalmars-d-learn
On Friday, 3 November 2023 at 00:57:30 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just do "dub add dfl". In Entice designer you can then change your co

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 12:47:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:43:01 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UT

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:43:01 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: [...] Yes,exactly. That was developed with D+iupD. Under windows,I use PoseidonD with Entice Designer+

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: [...] Yes,exactly. That was developed with D+iupD. Under windows,I use PoseidonD with Entice Designer+DFL: Entice Designer: http://www.dprogramming.com/entice.php DFL

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:57:57 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 11:32:40 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: [...] ```d --- w

Re: bigEndian in std.bitmanip

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:29:05 UTC, Salih Dincer wrote: On Tuesday, 31 October 2023 at 14:43:43 UTC, Imperatorn wrote: It might make sense to change since little endian is the most common when it comes to hardware. But big endian is most common when it comes to networking. So I guess

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Z

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UT

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountere

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding this

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding this: ```d pragma(lib, "user32"); pragma(lib, "comdlg32"); ```

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:01:06 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: [...] Works for me. This is all you need ```d import core.sys.windows.commdlg; import core.sys.windows.winuser; void main() { wchar[256] fileName; O

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : import core.sys.windows.windows; import core.sys.windows.commdlg; import core.sys.windows.winuser; extern(Window

Re: bigEndian in std.bitmanip

2023-10-31 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 31 October 2023 at 10:09:53 UTC, Salih Dincer wrote: Hello, Why isn't Endian.littleEndian the default setting for read() in std.bitmanip? Okay, we can easily change this if we want (I could use enum LE in the example) and I can also be reversed with data.retro.array(). ```d vo

Re: Unable to use template functions to define variables of a class

2023-10-28 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 28 October 2023 at 12:38:42 UTC, Subhaditya Nath wrote: This works fine – I think it's because you're using a class. Try for example: ```d import std.range; import std.stdio; import std.algorithm.iteration; void main() { auto cls = new Class; cls.range1.each!writeln; } c

Re: Want to try out string interpolation in D?

2023-10-27 Thread Imperatorn via Digitalmars-d-learn
On Monday, 23 October 2023 at 11:43:33 UTC, Imperatorn wrote: On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote: On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: [...] First of all thanks for writing this. Well this seems pretty nice... What DIP number is this? - I'd li

Re: DlangUI: how to change AppFrames?

2023-10-23 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 24 October 2023 at 04:38:58 UTC, Ki Rill wrote: I know how to change the current AppFrame: ```D window.mainWidget = myFrame; ``` But how do I exit this frame? I press the button, change to new frame, do the work, and now I want to return to the previous frame. How would I do this?

Re: Want to try out string interpolation in D?

2023-10-23 Thread Imperatorn via Digitalmars-d-learn
On Monday, 23 October 2023 at 11:12:20 UTC, matheus wrote: On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started ... Now try string interpolation: ```d import std.stdio; void main() { string name = "Johan"; int age = 37; int iq

Re: Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 22 October 2023 at 13:16:11 UTC, Imperatorn wrote: On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. [...] On Sunday, 22 October 2023 at

Re: Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. [...] On Sunday, 22 October 2023 at 13:13:55 UTC, Imperatorn wrote: Just a clarification. "open

Profiling using Visual Studio

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
I would just like to share some knowledge about profiling an exe using Visual Studio, since many might already have that installed. After you have built your executable with symbols, open VS and choose "Continue without code". Then just choose open Project/Solution (Ctrl+Shift+O) and go to "

Re: Want to try out string interpolation in D?

2023-10-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started Same instructions for DIP1027: ``` git clone https://github.com/WalterBright/dmd.git cd dmd git checkout dip1027 rdmd compiler/src/build.d ``` Then same instructions as above but without the need

Re: Want to try out string interpolation in D?

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 16:41:40 UTC, Imperatorn wrote: Here's a script to get you started ```bash git clone https://github.com/adamdruppe/dmd.git cd dmd git checkout interp rdmd compiler/src/build.d ``` [...] We just need support for it in the tools, then D will be a Dream come true

Want to try out string interpolation in D?

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
Here's a script to get you started ```bash git clone https://github.com/adamdruppe/dmd.git cd dmd git checkout interp rdmd compiler/src/build.d ``` I don't want to copy files anywhere, so the user has to do that manually: Copy dmd from the generated executable to your D bin installation fold

Re: Installing DMD on Windows

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Friday, 20 October 2023 at 12:19:32 UTC, Quirin Schroll wrote: I recently removed Visual Studio 2017 and upgraded to 2022. When I installed the latest DMD, it told me it couldn’t find a Visual Studio installation and offered me to download e.g. Visual Studio 2019 or just VS 2019 Build Tools,

Re: Can't get into debugger in vscode on macOS

2023-10-20 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 19 October 2023 at 06:03:06 UTC, Daniel Zuncke wrote: Hello, I need some help getting into the debugger in vscode on macOS. It did work some months ago but that was finicky to set up. Maybe I am forgetting something now? [...] This can also happen if there's not a correct progra

github copilot and dlang

2023-10-18 Thread Imperatorn via Digitalmars-d-learn
https://forum.dlang.org/post/lqwhddcncwrhcdlnw...@forum.dlang.org On Monday, 5 July 2021 at 15:56:38 UTC, Antonio wrote: Has someone tried github copilot (https://copilot.github.com/) with dlang? Access to the preview could be requested and, I think, main dlang team members could bypass the wai

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 13:31:39 UTC, Salih Dincer wrote: On Sunday, 15 October 2023 at 07:22:53 UTC, Imperatorn wrote: You already got a lot of good answers, I thought I'd just share this for anyone searching for nogc string formatting compatible with betterC: https://code.dlang.org

Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 07:53:28 UTC, Vitaliy Fadeev wrote: On Tuesday, 17 October 2023 at 07:22:41 UTC, Vitaliy Fadeev wrote: [...] `scriptlike` looks perfecto! ```D enum JMP_ADDR_R = ... ... import scriptlike; writeln( mixin(interp

Re: std.format with named args

2023-10-17 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 06:46:31 UTC, Vitaliy Fadeev wrote: Hi all! I want readable mixin. I want pass variable to string. I want string with named args. Like this: ```D enum JMP_ADDR_R = "RAX"; mixin( format!"asm { jmp [JMP_ADDR_R]; }"( JMP_ADDR_R ));// IT NOT WOR

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 20:06:02 UTC, ryuukk_ wrote: On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: [...] Show your code here on in Discord https://discord.gg/wKTvGNpc No, show your code here on the forum, don't nee

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm undefined reference to _My_struct__

Re: Search for the dialog library

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 15 October 2023 at 23:01:05 UTC, Alexander Zhirov wrote: On Sunday, 15 October 2023 at 21:46:44 UTC, Dmitry Ponyatov wrote: Maybe it's time to port the old warm tubby Turbo Vision into the glorious D lang? https://github.com/magiblot/tvision Since there was a conversation about th

Re: Benchmarks

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Friday, 13 October 2023 at 22:45:19 UTC, Imperatorn wrote: https://github.com/jinyus/related_post_gen Sequential processing time, less is better |Language| Time (5k posts) | 20k posts | 60k posts | Total | |:--:|:---:|:--:|:-:|::

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-15 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 14 October 2023 at 06:48:40 UTC, rempas wrote: On Friday, 13 October 2023 at 10:11:33 UTC, Nick Treleaven wrote: You can also do it using a string mixin: mixin(create_fn!(mixin("`", i, "`"))); I think that's equivalent to `i.stringof` anyway. Thank you for the info! You a

Re: Search for the dialog library

2023-10-14 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 14 October 2023 at 23:02:34 UTC, Alexander Zhirov wrote: Colleagues, tell me, please, is there any library on D for drawing [dialog](https://invisible-island.net/dialog/images/dialog.png) boxes using the dialog library, like in Python [pythondialog](https://pypi.org/project/python

Benchmarks

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
https://github.com/jinyus/related_post_gen

Re: use dmd for bare metal i386

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Friday, 13 October 2023 at 22:14:36 UTC, Dmitry Ponyatov wrote: Is dmd able to be forced not include some unneeded information into target object files to make bare metal 32-bit code? Need some samples and build scripts to do it. Or maybe move to ldc2 required You need ldc or gdc

Re: Need csv writer (std.csv only has csvReader)

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 23:18:23 UTC, John Xu wrote: Any friend can help me with a csvWriter? The std.csv only has a csvReader. I want to dump database from sqlite to mysql. If I do it manually, I need handle double quote("), \n, ',' specifically Also, if tsv is acceptable, I tried

Re: Need csv writer (std.csv only has csvReader)

2023-10-13 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 23:18:23 UTC, John Xu wrote: Any friend can help me with a csvWriter? The std.csv only has a csvReader. I want to dump database from sqlite to mysql. If I do it manually, I need handle double quote("), \n, ',' specifically Have you looked at https://code.dlan

Re: The Power of Grammar Checkers: A Game-Changer for Writers!

2023-10-12 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 12 October 2023 at 06:08:43 UTC, charles reiley wrote: I hope you're all doing well in your writing endeavors! Today, I wanted to share my thoughts and experiences with grammar checkers, and I can't emphasize enough how much of a game-changer they've been for me at [url=https://my

D http benchmarks

2023-10-11 Thread Imperatorn via Digitalmars-d-learn
Just sharing https://github.com/tchaloupka/httpbench

Re: extern (c)

2023-10-11 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 11 October 2023 at 13:36:16 UTC, Paul wrote: On Wednesday, 11 October 2023 at 12:54:53 UTC, user1234 wrote: `extern(C)` on module level functions affect the mangling and the calling convention. - Mangling is used by the linker to link symbols between objects. - Calling convent

Re: is the array literal in a loop stack or heap allocated?

2023-10-10 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 11 October 2023 at 02:54:53 UTC, mw wrote: Hi, I want to confirm: in the following loop, is the array literal `a` vs. `b` stack or heap allocated? and how many times? void main() { int[2] a; int[] b; int i; While(++i <=100) { a = [i, i+1]; // array literal b = [i, i+1];

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 22:49:11 UTC, Salih Dincer wrote: On Monday, 9 October 2023 at 16:33:32 UTC, rempas wrote: I'm trying to create a series of function. There will be ten of them, and they will be called `function_0`, `function_1`, etc. However, in my example, "stringof" returns the c

Re: How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 16:55:41 UTC, rempas wrote: On Monday, 9 October 2023 at 16:53:55 UTC, mw wrote: but you `import std.stdio;`? Or copy the std/conv.d over to your build, or copy / write a toString(int) function yourself, which is compile-time callable. I do on that example just

Re: array setting : Whats going in here?

2023-10-09 Thread Imperatorn via Digitalmars-d-learn
On Monday, 9 October 2023 at 02:19:20 UTC, Jonathan M Davis wrote: On Sunday, October 8, 2023 8:08:46 AM MDT Imperatorn via Digitalmars-d-learn wrote: [...] Except that in those examples, they _do_ match. It's perfectly valid to copy elements of a string to a char[]. It's jus

Re: array setting : Whats going in here?

2023-10-08 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 7 October 2023 at 00:00:48 UTC, claptrap wrote: char[] foo; foo.length = 4; foo[] = 'a'; // ok sets all elements foo[] = "a"; // range error at runtime? foo[] = "ab"; // range error at runtime? So I meant to init with a char literal but accidently used double quotes. Should that e

Re: The difference between T[] opIndex() and T[] opSlice()

2023-10-03 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 17:52:20 UTC, Paul Backus wrote: On Tuesday, 3 October 2023 at 16:45:39 UTC, Steven Schveighoffer wrote: OK, so it's not as bad as I thought, but surely the compiler should recognize that `opIndexAssign(val, idx)` doesn't work, but `opIndex(idx) = val` does? Ma

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 19:28:32 UTC, BoQsc wrote: On Monday, 2 October 2023 at 18:39:41 UTC, Imperatorn wrote: On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: [...] https://dlang.org/spec/operatoroverloading.html#binary Overloading seems to only overload behaviour of existing

Re: Define a new custom operator in D Language.

2023-10-02 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 18:34:13 UTC, BoQsc wrote: Here is my issue: I've found a formula on Wikipedia. It's called **Hashing by division**. ![](https://i.imgur.com/UJPAWIW.png) As you can see it uses **mod** keyword to achieve the modulus operation. In D language we use modulus operato

Re: Key and value with ranges

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 02:47:37 UTC, Joel wrote: ```d import std; auto data=“I went for a walk, and fell down a hole.”; You can improve it further by inlining ```d import std; auto data = "I went for a walk, and fell down a hole."; void main(string[] args) { int[string] dic;

Re: Key and value with ranges

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Monday, 2 October 2023 at 02:47:37 UTC, Joel wrote: ```d import std; auto data=“I went for a walk, and fell down a hole.”; void main(string[] args) { int[string] dic; struct WordCnt { string word; ulong count; string toString() const { return text(

Re: Straight Forward Arrays

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 13:24:27 UTC, dhs wrote: On Sunday, 1 October 2023 at 13:05:12 UTC, Steven Schveighoffer wrote: On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tu

Re: Straight Forward Arrays

2023-10-01 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 09:01:53 UTC, dhs wrote: Hi, Is there a straight forward Array type in D similar to C++'s vector class? Something along the lines of the tuple: (pointer to elements, length, capacity). [...] https://dlang.org/spec/simd.html https://dlang.org/phobos/core_simd.ht

Re: startsWith

2023-09-30 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 1 October 2023 at 05:33:36 UTC, Joel wrote: ```d void main() { import std.string : split; import std.algorithm.searching : startsWith; string bk="Exo"; assert(("Gen Exo Lev Num Deu Jos Judg Rut 1Sam 2Sam".split~ "1Kin 2Kin 1Chr 2Chr Ezra Neh Est Job Psa Pr

Re: Binary size optimization

2023-09-28 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 28 September 2023 at 08:38:42 UTC, Imperatorn wrote: Today I randomly tried compiling a hello world using DMD, LDC and gcc (yes, not gdc) I compared binary sizes and something looked off. The D ones were much larger. Sometimes 10x, with some optimizations still about 2x. But, t

Re: Is it possible to create a kernel for an operating system in D?

2023-09-26 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 26 September 2023 at 03:31:36 UTC, I come from chill. wrote: It seems very obvious, but I have not been able to find any information on the subject to confirm this. So I'm wondering if it's possible. ** Maybe I shouldn't have created the account, literally this will be one of the

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download. If you want an asynchro

Re: change object class

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 14:03:40 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 12:53:28 UTC, Imperatorn wrote: On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev wrote: [...] What I mean is, why not use other language constructs like mixins or inheritance with

Re: parallelism with delegate

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev wrote: able ? how to use correctly? ```d import std.parallelism; auto async_task = task!fn( args ); // error // Error: no property `opCall` for type `app.A`, did you mean `new A`? async_

Re: change object class

2023-09-22 Thread Imperatorn via Digitalmars-d-learn
On Friday, 22 September 2023 at 03:33:08 UTC, Vitaliy Fadeev wrote: On Friday, 22 September 2023 at 02:51:10 UTC, Vitaliy Fadeev wrote: ... ``` Chip id name Sense() Draw() ``` instance ``` chip = new Chip(); ``` compiled to ``` chip __vtbl -> Chip __monito

Re: change object class

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 17 September 2023 at 15:05:59 UTC, Vitaliy Fadeev wrote: Hi! I want to change a method ```Draw``` on a custom object when the ```MouseIn``` event occurs. This is known as "Change State" of the object: ```Init``` -> ```Hovered```. [...] Interesting, but why would you want to do it

Re: Detect 8-bit alligned type TXY by TX,TY.

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 19 September 2023 at 06:41:49 UTC, Vitaliy Fadeev wrote: On Tuesday, 19 September 2023 at 06:33:25 UTC, Richard (Rikki) Andrew Cattermole wrote: [...] Thank, Richard. ```.offsetof...``` mmm... May be exists some like: ```d // TXYXY = Detect!(TX,TX) // Detect!(uint,uint) == ulong

Re: C to D: please help translate this weird macro

2023-09-21 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 20 September 2023 at 13:53:08 UTC, Ki Rill wrote: Here is the macro: ```C #define NK_CONTAINER_OF(ptr,type,member)\ (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member))) ``` I'm trying to translate the Nuklear GUI library to D [here](https://

Re: Terminating the process of a running LDC2 compiler.

2023-03-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 11:38:11 UTC, realhet wrote: Hello, Is it safe to kill an ongoing LDC2 process on Windows? My situation is this: - I launch 8 LDC2 compilation command lines on 8 DLang source files. - One of them has a compilation error and quits. - At this point I wait the compl

Re: Running GtkD programs on macOS

2022-11-29 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 29 November 2022 at 07:17:09 UTC, Joel wrote: On Saturday, 30 November 2019 at 00:17:51 UTC, Mike Wey wrote: On 29-11-2019 04:40, Joel wrote: Oh, I used 'brew install gtk+3', and the test program worked, but (see below) I don't know about all that installing - is that alright? Th

Re: Get the class name without casting the type

2022-11-15 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 15 November 2022 at 12:25:22 UTC, Hipreme wrote: On Tuesday, 15 November 2022 at 11:42:59 UTC, Alexander Zhirov wrote: As shown you can use Object for this. Side-note, you don't override interface members, you implement them. ```d interface A { string

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Monday, 14 November 2022 at 14:43:50 UTC, Preetpal wrote: On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote: On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: [...] Have you set longPathAware in the applications manifest? Yeah that's how I dealt with the issue. I

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Monday, 14 November 2022 at 10:44:11 UTC, Imperatorn wrote: On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) whi

Re: How to work with long paths on Windows?

2022-11-14 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 13 September 2022 at 19:54:15 UTC, Preetpal wrote: In Windows 10, Version 1607 (and later), you can [enable long paths](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) which bypasses the MAX_PATH limitation for local paths (e.g., C:\Us

Re: Proper way to exit with specific exit code?

2022-11-13 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 13 November 2022 at 21:37:47 UTC, mw wrote: On Sunday, 13 November 2022 at 21:16:32 UTC, mw wrote: I even tried core.stdc.stdlib.exit(-1), it does not work. Tried ``` import core.runtime; Runtime.terminate(); core.stdc.stdlib.exit(-1); ``` Still does not work. I have no id

Re: Making sense out of scope and function calls

2022-11-13 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 13 November 2022 at 19:06:40 UTC, 0xEAB wrote: ```d struct Foo { /* … */ hstring[] getHeader(LowerCaseToken name) scope return { return _headers[name].values; } [...] There's an old saying "you can't make sense out of scope"

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for me:

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:59:57 UTC, Ali Çehreli wrote: On 11/9/22 11:48, Imperatorn wrote: > That's not the behaviour I get in Windows. Windows users deserve it! :p (At least it is better in this case. :) ) > When I create the subdirectory, I see it even if it's empty struct DirI

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 20:06:15 UTC, Ali Çehreli wrote: On 11/9/22 11:05, Ali Çehreli wrote: It was pretty easy to use but there is a quality issue there: They failed to support a 'void*' context for the user! You can walk the tree but can't put the results into your local context!

Re: dirEntries removes entire branches of empty directories

2022-11-09 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: In case it matters, the file system is ext4. 1) Create a directory: [...] That's not the behaviour I get in Windows. When I create the subdirectory, I see it even if it's empty

Re: My new programming book ...

2022-11-06 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 6 November 2022 at 22:43:33 UTC, ikelaiah wrote: Hi, I got a new programming book yesterday, authored by Adam D. Rupee. [...] Agreed. It's a great book with a "get it done"-attitude <3

Re: Linking not working properly Windows 11

2022-11-05 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 5 November 2022 at 13:30:43 UTC, bauss wrote: Fresh install of DMD and when trying to use ex. std.file from Phobos I get the following linking error: (I can trigger different ones depending on modules imported etc.) [...] Im also on Windows 10 and 11 and don't have any problems

Re: Makefiles and dub

2022-11-05 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 5 November 2022 at 11:38:09 UTC, rikki cattermole wrote: We have a few build formats that dub can generate for you automatically: ``` visuald - VisualD project files sublimetext - SublimeText project file cmake - CMake build scripts build - Builds the package directly ``` Unfortun

Re: save() feature for iota

2022-11-04 Thread Imperatorn via Digitalmars-d-learn
On Friday, 4 November 2022 at 08:48:36 UTC, Salih Dincer wrote: On Thursday, 3 November 2022 at 11:58:20 UTC, Paul Backus wrote: On Thursday, 3 November 2022 at 06:26:22 UTC, Salih Dincer Looking at the source, it seems that only the numeric overloads of `iota` implement `save`. I think this is

Re: Hipreme's #3 Tip of the day - Changing DMD linker on Windows

2022-11-03 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 1 November 2022 at 16:17:08 UTC, Hipreme wrote: The linker used on Windows when installing DMD is pretty much decided on how your PC was setup. [...] Do you have a blog?

  1   2   3   4   5   >