Re: Edit

2020-10-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 5 October 2020 at 11:14:47 UTC, frame wrote: So I found out that there is nothing wrong with the method as in a test environment the allocated memory block is removed after GC.minimize(). Still need to find out why other blocks are not released. However, is there a way to debug

Re: Selective unittesting in DUB

2020-11-30 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 19:49:20 UTC, Jacob Carlborg wrote: On 2016-12-21 19:07, Nordlöw wrote: Is there a way to specify in dub.json (or any other file) that only a subset of the sources compiled and linked to a library or app should have they're unittests enabled? You can use

Re: Selective unittesting in DUB

2020-11-30 Thread ryuukk_ via Digitalmars-d-learn
Running .\dawn-test-application.exe 2 modules passed unittests Wich ones? it should print ``` Running tests for target X - src/module_a.d Tests: OK <-- line in green - src/module_b.d Tests: OK - src/module_c.d Tests: OK - src/module_e.d

Re: Variadic Struct Parameter

2021-01-12 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 12 January 2021 at 18:44:53 UTC, Jonathan Levi wrote: On Tuesday, 12 January 2021 at 17:46:14 UTC, Q. Schroll wrote: It's obvious why arrays work, it's the primary use case. I have no idea why classes are allowed. That classes are allowed, but structs are not, makes no sense to me.

Re: Vibe.d tutorial

2021-03-01 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 1 March 2021 at 22:25:39 UTC, Rey Valeza wrote: Hi, I wrote a tutorial on Vibe.d while trying to re-learn Vibe.d. I find that most of Kai Nacke's book need updating, so I wrote a tutorial while trying to re-learn it. Here it is.

Re: tiny alternative to std library

2021-03-05 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 5 March 2021 at 16:54:48 UTC, Kagamin wrote: On Wednesday, 3 March 2021 at 20:54:43 UTC, Anthony Quizon wrote: I'm having some success pulling out small bits of code from other libraries and keeping things minimal and c-style-ish. If you're really ok with minimalism, I'm writing

Re: DUB is not working correctly

2021-02-26 Thread ryuukk_ via Digitalmars-d-learn
"targetType": "executable", and it should just run using "dub run"

Re: GC memory fragmentation

2021-04-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 11 April 2021 at 13:50:12 UTC, tchaloupka wrote: On Sunday, 11 April 2021 at 12:20:39 UTC, Nathan S. wrote: One thing that comes to mind: is your application compiled as 32-bit? The garbage collector is much more likely to leak memory with a 32-bit address space since it much more

Re: GC memory fragmentation

2021-04-11 Thread ryuukk_ via Digitalmars-d-learn
I should have added https://dub.pm/package-format-json#build-types profileGC as build option in your dub file That will generate a profile_gc file once the program exit, a table that lists all the allocations

Re: Are there any containers that go with allocators?

2021-02-13 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 12:18:41 UTC, John Burton wrote: Normally I'm happy with the GC containers in D, they work well and suit my use. I have a few uses that would benefit from allocation in memory arenas or local stack based allocation. Looks like std.experimental has allocators

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-10 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 8 September 2023 at 13:34:42 UTC, Richard (Rikki) Andrew Cattermole wrote: In case you didn't know, all you need to get unittests working in -betterC is: ```d foreach (module_; allModules) { foreach (unitTest;

Re: Setting struct as default parameter of a function using struct literal?

2023-09-11 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 11 September 2023 at 17:51:04 UTC, BoQsc wrote: https://docarchives.dlang.io/v2.073.0/spec/struct.html#struct-literal I would like to set function's default struct for a function in a way that it would be visible for the reader to see what options are set. Something like `Options

Re: I don't understand betterC

2023-09-01 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 1 September 2023 at 13:17:08 UTC, confused wrote: On Friday, 1 September 2023 at 08:19:55 UTC, Richard (Rikki) Andrew Cattermole wrote: ``size_t`` is defined in ``object.d`` which is implicitly imported into all modules. If it cannot be found, one of three things is happening: 1)

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: 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

Re: win32 api & lib issue

2023-11-02 Thread ryuukk_ 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

Re: Symbolic computations in D

2023-10-29 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 29 October 2023 at 08:55:24 UTC, Dmitry Ponyatov wrote: Yesterday some student asked me about ability to make some dumb symbolic computation in C++ the same like way as it looks in the MathCAD or Maxima CAS, but run it compiled on a robot platform in realtime. I have no idea about

Re: Dlang installer with VSCode broken

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Looks like his vscode is outdated, make sure your friend has the latest version installed

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Here is how adam seems to be doing it: https://github.com/adamdruppe/webassembly/blob/731a7033174127c0a6dd4f23eabdb440adab286b/arsd-webassembly/object.d#L650-L681 Specially here: ```D void destroy(bool initialize = true, T)(T obj) if (is(T == class)) { (..) else { // Bypass

Re: How should class objects created in betterC be destroyed

2023-11-06 Thread ryuukk_ via Digitalmars-d-learn
Please tag your code accordingly, as is it's unreadable ```D // your code here ``` (tick the "Enable Markdown" too, next to the Send button)

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

2023-09-20 Thread ryuukk_ 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

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

2023-09-27 Thread ryuukk_ 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: Type constraint

2023-10-03 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 11:43:46 UTC, Joel wrote: I’ve got a struct that has a method that adds numbers together. I want to do something like this, static if (isInteger!T) … but it isn’t working. static if (is(T==int)) works for one integer type. ```d struct List(T) { auto addUp()

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 15:12:34 UTC, Joel wrote: The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? ```d // Adding program - literal functions import std; struct List(T) { class Node

Re: how to assign multiple variables at once by unpacking array?

2023-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 7 October 2023 at 17:23:40 UTC, ryuukk_ wrote: On Saturday, 7 October 2023 at 07:31:45 UTC, mw wrote: https://stackoverflow.com/questions/47046850/is-there-any-way-to-assign-multiple-variable-at-once-with-dlang How to do this Python code in D: ``` s = "1 2 3" A,B,C = map(int,

Re: how to assign multiple variables at once by unpacking array?

2023-10-07 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 7 October 2023 at 07:31:45 UTC, mw wrote: https://stackoverflow.com/questions/47046850/is-there-any-way-to-assign-multiple-variable-at-once-with-dlang How to do this Python code in D: ``` s = "1 2 3" A,B,C = map(int, s.split(" ")) A,B,C (1, 2, 3) ``` Is there a better way

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

2023-10-19 Thread ryuukk_ 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? I am compiling the project with `dub build --build debug

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

2023-10-10 Thread ryuukk_ 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: toLower

2023-08-15 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 15 August 2023 at 16:47:36 UTC, Joel wrote: How come toLower works in the sort quotes, but not in the map? ```d void main() { import std; "EzraTezla" .to!(char[]) .byCodeUnit .sort!"a.toLower c.toLower) .writeln; } ``` onlineapp.d(60): Error:

Re: UI Library

2022-05-20 Thread ryuukk_ via Digitalmars-d-learn
Avoid GTK, it's bloated, GTK4 looks like a toolkit to design mobile apps, and you need runtime dependencies on windows adam's gui library is very nice, 0 dependencies I personally prefer IMGUI, 0 dependencies, you bring the windowing library of your choice, i pick GLFW since it's minimal

Unwrap variadic template into vararg of pointers of the same types

2022-07-08 Thread ryuukk_ via Digitalmars-d-learn
I'm not sure how to phrase it so it'll try with code I have this piece of code that i would like to improve, right now i have to create bunch of duplicates ```D void view_it(A, B)(void function(entity_t, A*, B*) cb) { foreach(it, e; view!(Includes!(A, B))) {

Re: How to call a function from a dll created with d ?

2022-07-01 Thread ryuukk_ via Digitalmars-d-learn
I think it is `extern(D) void testFunc();`?

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread ryuukk_ via Digitalmars-d-learn
How do i achieve fast compile speed (results above were on windows, on linux i get much faster results): I maintain healthy project management: - Templates ONLY when necessary and when the cost is worth the time saved in the long term - this is why i try to lobby for builtin tagged union

Re: Unwrap variadic template into vararg of pointers of the same types

2022-07-11 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 8 July 2022 at 12:48:20 UTC, Paul Backus wrote: On Friday, 8 July 2022 at 12:20:13 UTC, ryuukk_ wrote: The problem when i try to introduce variadic template, is i can't seem to understand how to unwrap the parameter as pointer type T -> T* ```D struct Includes(Args...) { alias

Re: vectorization of a simple loop -- not in DMD?

2022-07-11 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 11 July 2022 at 21:46:10 UTC, IGotD- wrote: On Monday, 11 July 2022 at 18:19:41 UTC, max haughton wrote: The dmd backend is ancient, it isn't really capable of these kinds of loop optimizations. I've said it several times before. Just depreciate the the DMD backend, it's just

Re: vectorization of a simple loop -- not in DMD?

2022-07-12 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 12 July 2022 at 12:47:26 UTC, bauss wrote: Of course if you're alone it doesn't matter, but if it's a larger project that will have multiple maintainers then it will never work and will tarnish the project entirely. That's true, i work solo on my project so it doesn't bother me

ImportC: unresolved external symbol

2022-06-14 Thread ryuukk_ via Digitalmars-d-learn
Hello Tried to give ImportC a try to finally get rid of gluecode in one of my project, but this simple test gives me a compile error: nk.c ``` int test(void) { return 1; } ``` app.d ``` import std.stdio; import nk = nk; void main() { if (nk.test() != 0) {

Re: ImportC: unresolved external symbol

2022-06-14 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 14 June 2022 at 14:38:17 UTC, Mike Parker wrote: On Tuesday, 14 June 2022 at 14:32:50 UTC, ryuukk_ wrote: ``` nk.obj : error LNK2019: unresolved external symbol test referenced in function _Dmain ``` Am i missing something important? (that is a dub project, created with: dub

Re: "Memory allocation failed" on big array

2022-07-20 Thread ryuukk_ via Digitalmars-d-learn
My guess is you are compiling to 32bit and the GC tries to reserve >4gb wich it can't, therefore out of memory Compiling to 64bit with: `dmd -m64 -run test.d` works no problem

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
Here is the way to do it with `writefln` (i think) ```D import std; import core.stdc.string; void main() { const(char)[] ch = "Hello World!"; const(char)[] ch2 = "abc"; const(char)* p; p = [0]; p++; auto str = p[0 .. strlen(p)]; writefln("%s", str); } ```

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 25 July 2022 at 11:14:56 UTC, pascal111 wrote: On Monday, 25 July 2022 at 09:36:05 UTC, ryuukk_ wrote: Here is the way to do it with `writefln` (i think) ```D import std; import core.stdc.string; void main() { const(char)[] ch = "Hello World!"; const(char)[] ch2 = "abc";

Re: char* pointers between C and D

2022-07-25 Thread ryuukk_ via Digitalmars-d-learn
I don't know what `writefln` is doing, but this following D code is the exact similar to your C code ``` import core.stdc.stdio; void main() { const(char)[] ch = "Hello World!"; const(char)* p; p = [0]; p++; printf("%s", p); } ``` `ello World!`

Re: vectorization of a simple loop -- not in DMD?

2022-07-14 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 14 July 2022 at 05:30:58 UTC, Siarhei Siamashka wrote: On Tuesday, 12 July 2022 at 13:23:36 UTC, ryuukk_ wrote: I wonder if DMD/LDC/GDC have built in tools to profile and track performance Linux has a decent system wide profiler: https://perf.wiki.kernel.org/index.php/Main_Page

Re: A converting problem in using "among" with arrays

2022-07-29 Thread ryuukk_ via Digitalmars-d-learn
FYI, you can use the markdown code tag so your code is properly rendered when viewed from the forums (make sure to tick the "Enable Markdown", right next to Send) ``` ```D void my_function() { } ``` ``` it'll be rendered like this: ```D void my_function() { } ```

Re: Some user-made C functions and their D equivalents

2022-07-27 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote: I made a library of some useful functions while I was studying C, and I'm curious to know if D has equivalents or some ones for some of my functions, or I have to retype 'em again in D. The library link:

Re: Some user-made C functions and their D equivalents

2022-07-27 Thread ryuukk_ via Digitalmars-d-learn
I don't remember the exact syntax for GDC, but it should be pretty similar to DMD You need to pass the module to the compiler gdc main.d dcollect.d

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-29 Thread ryuukk_ via Digitalmars-d-learn
I forgot to add: this is on Windows, the problem doesn't exist with linux I reported a bug here: https://issues.dlang.org/show_bug.cgi?id=23310

Code compiles and run fine with LDC but segfault with DMD

2022-08-29 Thread ryuukk_ via Digitalmars-d-learn
The following code compiles and run fine with LDC, but with DMD it compiles and then default at runtime ```D -- app.d enum Test {A, B, C} Test test = Test.A; extern(C) void main() { switch(test) { default: break; } } ``` ``` -- object.d // empty for now ```

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-30 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 30 August 2022 at 11:24:21 UTC, wjoe wrote: On Monday, 29 August 2022 at 21:46:48 UTC, ryuukk_ wrote: What `-g` does that makes this code compile and work with DMD? This flag adds symbolic debug info. But I'm confident you knew that already. You didn't understand the question

Re: Code compiles and run fine with LDC but segfault with DMD

2022-08-30 Thread ryuukk_ via Digitalmars-d-learn
Problem fixed, i had to copy bunch of other code from druntime Here is a working object.d: https://gist.github.com/ryuukk/53c133f29da5a8326c359a6bb1063207

Re: How to pass noncopyable variadic arguments with ref?

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 20 October 2022 at 14:03:10 UTC, tchaloupka wrote: Hi, I've found strange behavior where: ```D import std.stdio; struct Foo { @disable this(this); int x; } void test(Foo[] foos...) { foreach (ref f; foos) { writeln(, ": ", f.x); f.x = 0; } } void

Re: Find out what type my class is being converted to for comparisons

2022-10-19 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 18 October 2022 at 18:53:41 UTC, Matthew Rushworth wrote: I am in the process of building a matrix class (uni project, with my choice of programming language) and appear to have run into a problem that I'm not too sure how to fix. My class uses templates to define the shape of the

Re: Catching C errors

2022-10-19 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 19 October 2022 at 16:47:49 UTC, data pulverizer wrote: On Wednesday, 19 October 2022 at 14:05:35 UTC, data pulverizer wrote: Hi all, I am calling code from a C API, and would like to know how to catch exit errors so that they can be handled and make them more like an

Re: How to use dub with ldc

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 18:08:51 UTC, tobi wrote: Hi, I'm new to D and I would like to get the dlang-tour onto my local machine. As far as I know, on my Pinebook Pro using aarm64 architecture, I must use the LDC compiler. The dlang-tour readme says to run `dub run dlang-tour --

Re: Disabling All Inlining in DMD Debug Builds

2022-10-24 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 24 October 2022 at 19:28:34 UTC, Jack Stouffer wrote: I use ``` pragma(inline, true) function definition ``` all over my code. And by default, DMD inlines these functions even in debug builds, which normally is great. I have a custom dynamic array container and if the indexing

Re: [Help Needed] - Debugging compilation time

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 12:27:21 UTC, Hipreme wrote: On Friday, 21 October 2022 at 18:10:39 UTC, ryuukk_ wrote: I tried your project: Linux x64 ``` git clone https://github.com/MrcSnm/HipremeEngine.git cd HipremeEngine dub build (once to download dependencies if any) time dub build -f

Re: is dmd a virus?

2022-10-22 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 22 October 2022 at 07:40:39 UTC, MGW wrote: is dmd a virus? https://www.virustotal.com report: Cybereason --> Malicious.779f29 VBA32 --> BScope.Trojan.DShell It's obviously not We need to contact these companies and let them know about the false positive Someone who has an

Re: Disabling All Inlining in DMD Debug Builds

2022-10-25 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 25 October 2022 at 08:14:26 UTC, Per Nordlöw wrote: On Monday, 24 October 2022 at 20:43:45 UTC, ryuukk_ wrote: I wish we could do ``version(DebugFast | Release)`` Moreover, I've been using, for instance, ```d version(D_Coverage) {} else pragma(inline, true); void foo() {} ``` to

Re: dub ldc2 static linking

2022-10-27 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 28 October 2022 at 01:35:04 UTC, kinke wrote: For fully static linking on Linux, you'll need to move away from glibc to e.g. the musl C runtime, as used by the Alpine distro. I'm just right now having an issue with glibc version mismatch for my server, so i'm looking to move to

Re: dub ldc2 static linking

2022-10-27 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 28 October 2022 at 02:46:42 UTC, ryuukk_ wrote: On Friday, 28 October 2022 at 01:35:04 UTC, kinke wrote: For fully static linking on Linux, you'll need to move away from glibc to e.g. the musl C runtime, as used by the Alpine distro. I'm just right now having an issue with glibc

Re: [Help Needed] - Debugging compilation time

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
I tried your project: Linux x64 ``` git clone https://github.com/MrcSnm/HipremeEngine.git cd HipremeEngine dub build (once to download dependencies if any) time dub build -f real0m4.604s user0m3.686s sys 0m0.900s ``` 4.6 sec for a FULL rebuild doesn't seem that bad and ``` real

Re: [Help Needed] - Debugging compilation time

2022-10-21 Thread ryuukk_ via Digitalmars-d-learn
Make sure you have the latest version of DMD Make sure your antivirus isn't blocking your files (scanning), it's a common thing with Windows, whitelist dmd folder, your dev folder and dub folder

Re: Is `void` the correct way to say "do not initialize this variable"?

2022-10-02 Thread ryuukk_ via Digitalmars-d-learn
I got the answer thanks to IRC chat: https://dlang.org/spec/declaration.html#void_init

Is `void` the correct way to say "do not initialize this variable"?

2022-10-02 Thread ryuukk_ via Digitalmars-d-learn
I have tried to look at the documentation and various places on the DMD source, but i couldn't find the answer ```D MyStruct test = void; ``` Does this guarantee that the compiler will not initialize it? Does it work with static arrays of struct too? The generated code is different than

Re: Request assistance resolving linker error: Undefined symbol(s) for architecture x86_64

2022-08-03 Thread ryuukk_ via Digitalmars-d-learn
Does adding ```-m64``` work

Re: A strange DMD error

2022-11-01 Thread ryuukk_ via Digitalmars-d-learn
This reminds me of an issue i reported last year... https://issues.dlang.org/show_bug.cgi?id=22583

Re: Is there such concept of a list in D?

2022-12-11 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 10 December 2022 at 05:46:26 UTC, thebluepandabear wrote: In most languages there is some sort of `List` type, is that the same for D? There is: https://dlang.org/phobos/std_container_dlist.html Why is it called ``DList`` and not just ``List``, i have no clue

Re: Why can't rvalues be passed to a 'ref' parameter?

2022-12-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 11 December 2022 at 04:36:45 UTC, thebluepandabear wrote: Hello, I am not really understanding why rvalues cannot be passed to a 'ref' parameter, the explanation in the book about D I am reading was not clear: "The main reason for this limitation is the fact that a function

Re: printf, writeln, writefln

2022-12-06 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 6 December 2022 at 23:41:09 UTC, H. S. Teoh wrote: On Tue, Dec 06, 2022 at 11:07:32PM +, johannes via Digitalmars-d-learn wrote: //-- the result should be f.i. "the sun is shining" //-- sqlite3_column_text returns a constant char* a \0 delimited c-string

Re: printf, writeln, writefln

2022-12-06 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 7 December 2022 at 01:46:21 UTC, Siarhei Siamashka wrote: On Tuesday, 6 December 2022 at 23:07:32 UTC, johannes wrote: //-- the result should be f.i. "the sun is shining" //-- sqlite3_column_text returns a constant char* a \0 delimited c-string

Re: Is there such concept of a list in D?

2022-12-13 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 12 December 2022 at 07:57:28 UTC, TTK Ciar wrote: On Sunday, 11 December 2022 at 17:45:20 UTC, ryuukk_ wrote: Why is it called ``DList`` and not just ``List``, i have no clue Probably because it is a *D*ouble-linked List :-) oh right, thanks, i never used that module before i

Re: LSP-server for D?

2022-12-05 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 5 December 2022 at 18:36:08 UTC, Per Nordlöw wrote: On Monday, 5 December 2022 at 12:38:07 UTC, Per Nordlöw wrote: On Monday, 5 December 2022 at 12:23:24 UTC, Per Nordlöw wrote: Is there a D lsp-server available? I couldn't find anything at https://code.dlang.org/search?q=lsp. Am I

Re: Idiomatic D using GC as a library writer

2022-12-04 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 4 December 2022 at 09:53:41 UTC, vushu wrote: Dear dlang community. I am unsure about what idiomatic D is. Some of the Dconf talks tells people just to use the GC, until you can't afford it. If there are documents that describes what idiomatic D is then I would appreciate it.

Re: How to use version in dub?

2022-12-13 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 13 December 2022 at 20:01:40 UTC, torhu wrote: On Tuesday, 13 December 2022 at 19:50:15 UTC, torhu wrote: On Tuesday, 13 December 2022 at 19:28:44 UTC, Leonardo A wrote: Hello. How to use version in dub? https://dlang.org/spec/version.html "The version level and version identifier

Re: Is defining get/set methods for every field overkill?

2022-11-23 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 17 November 2022 at 04:39:35 UTC, thebluepandabear wrote: I am creating a TUI library and I have a class with the following constant fields: ``` class Label : Renderable { const string text; const TextAlignment textAlignment; const Color color; this(Dimensions

Re: raylib-d Gamepad Detection Fails

2022-11-30 Thread ryuukk_ via Digitalmars-d-learn
On Wednesday, 30 November 2022 at 22:46:52 UTC, jwatson-CO-edu wrote: Hello, I have this small [gamepad input test program](https://github.com/jwatson-CO-edu/nanoverse/blob/main/d/raylib/04_jsInput/source/app.d). In the program, I poll the first 3 gamepad IDs, but all detection attempts

Re: raylib-d Gamepad Detection Fails

2022-12-01 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 1 December 2022 at 01:49:09 UTC, jwatson-CO-edu wrote: On Thursday, 1 December 2022 at 01:12:17 UTC, Steven Schveighoffer wrote: On 11/30/22 7:28 PM, jwatson-CO-edu wrote: On Wednesday, 30 November 2022 at 23:18:33 UTC, ryuukk_ wrote: On Wednesday, 30 November 2022 at 22:46:52

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-25 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 23 January 2023 at 00:11:17 UTC, thebluepandabear wrote: On Sunday, 22 January 2023 at 18:30:59 UTC, ryuukk_ wrote: On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: D is not java/C#, it's better than that! ```D // api.d void draw(){} // app.d import API =

Re: Problem with ImportC example?

2023-01-17 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 17 January 2023 at 17:12:49 UTC, DLearner wrote: On Tuesday, 17 January 2023 at 15:55:40 UTC, bachmeier wrote: On Tuesday, 17 January 2023 at 13:21:37 UTC, DLearner wrote: On Tuesday, 17 January 2023 at 11:21:08 UTC, Dennis wrote: On Tuesday, 17 January 2023 at 11:16:25 UTC,

Re: More Elegant Settable Methods?

2023-01-21 Thread ryuukk_ via Digitalmars-d-learn
```D TestStruct ts = { a: 2, b: 3, op: (s) { return s.a + s.b; } }; ``` This simple! just like with C's designated initializers

Re: More Elegant Settable Methods?

2023-01-21 Thread ryuukk_ via Digitalmars-d-learn
Oops i clicked "Send" too fast

Re: BetterC unexpected results

2023-01-08 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 8 January 2023 at 13:49:22 UTC, DLearner wrote: I thought dynamic arrays were unavailable under -betterC. Example_02: ``` extern(C) void main() { import core.stdc.stdio : printf; int[] A; printf("Hello betterC\n"); } ``` ``` dmd -betterC -run Example_02 ``` Expected

Re: Non-ugly ways to implement a 'static' class or namespace?

2023-01-22 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 20 January 2023 at 11:28:23 UTC, thebluepandabear wrote: D is not java/C#, it's better than that! ```D // api.d void draw(){} // app.d import API = api; void main() { API.draw(); } ```

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-04 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote: Package.d is a real problem existing on our currently modules design. First is that it means to take the directory name to use as a module. This is a problem for 3 reasons: 1. You won't be able to find your module by the file name.

Re: Hipreme's #4 Tip of the day - Don't use package.d

2022-11-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 November 2022 at 10:18:33 UTC, Hipreme wrote: On Saturday, 5 November 2022 at 01:34:04 UTC, ryuukk_ wrote: On Friday, 4 November 2022 at 10:57:12 UTC, Hipreme wrote: Package.d is a real problem existing on our currently modules design. First is that it means to take the

Re: Linking not working properly Windows 11

2022-11-05 Thread ryuukk_ 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.) ``` lld-link: error: undefined symbol: tzset ``` I assume it

Re: Can't seem to find the relevant documentation for dub.

2022-10-31 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 31 October 2022 at 20:20:49 UTC, WhatMeWorry wrote: I've got a pretty straightforward SDL dub file dependency "bindbc-opengl"version="~>1.0.3" versions "GL_46" dependency "bindbc-glfw" version="~>1.0.1" versions "GLFW_33" dependency "gl3n" version="~>1.4.1"

Re: Linking not working properly Windows 11

2022-11-05 Thread ryuukk_ via Digitalmars-d-learn
On Saturday, 5 November 2022 at 19:19:09 UTC, bauss wrote: On Saturday, 5 November 2022 at 14:54:52 UTC, Hipreme wrote: On Saturday, 5 November 2022 at 14:14:16 UTC, bauss wrote: On Saturday, 5 November 2022 at 13:42:08 UTC, rikki cattermole wrote: Try ldc, if that works then its just a

Re: Best way to read/write Chinese (GBK/GB18030) files?

2023-03-06 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 7 March 2023 at 01:45:27 UTC, John Xu wrote: I'm new to dlang. I didn't find much tutorials on internet about how to read/write Chinese easily. std.encoding doesn't seem to support GBK or GB18030: "Encodings currently supported are UTF-8, UTF-16, UTF-32, ASCII, ISO-8859-1 (also

Re: Using bindbc-sdl with D

2023-03-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:12:45 UTC, idsize wrote: I started learning D a few weeks ago and am enjoying it so far. I would like to use SDL with D and found bindbc-sdl, but I cannot figure out how to make it work. From my understanding, I'll need to use 'dub fetch bindbc-sdl' to download

Re: Using bindbc-sdl with D

2023-03-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 12 March 2023 at 02:59:20 UTC, Richard (Rikki) Andrew Cattermole wrote: On 12/03/2023 3:24 PM, Richard (Rikki) Andrew Cattermole wrote: But ugh that error looks weird. That would imply its trying to run the C preprocessor for ImportC. That does not sound right at all, I don't see

Any ways to get addr2line working with DMD? works fine with GDC

2023-03-16 Thread ryuukk_ via Digitalmars-d-learn
Hello, I'm trying to catch segfaults, after reading lot of ressources online, i came up with this: ```D import core.stdc.signal: SIGSEGV, SIGFPE, SIGILL, SIGABRT, signal; import core.stdc.stdlib: free; import core.stdc.string: strlen; import core.sys.posix.unistd: STDERR_FILENO, readlink;

Re: Any ways to get addr2line working with DMD? works fine with GDC

2023-03-17 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 17 March 2023 at 20:53:07 UTC, WB wrote: On Thursday, 16 March 2023 at 22:07:04 UTC, ryuukk_ wrote: Hello, The problem is when i compile with DMD i get: ``` ??:0 ``` When i compile it with GDC i get proper file + line What does GDC do different than DMD? Is there a way to get

DMD: what's the proper way to get a list of symbols from a Module object?

2023-03-13 Thread ryuukk_ via Digitalmars-d-learn
Hello, I am playing a little bit with DMD to get familiar with it (just to get a basic overview of it) I'm trying to come up with a proof of concept for https://github.com/dlang/DIPs/blob/master/DIPs/DIP1044.md ```D enum Tester { KNOWN = 1, WITHAUTO = 2 } void func(Tester a,

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
Perhaps in ``-betterC`` tls vars should be annotated with ``@tls``, and the default is not tls just like in C?

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
With -betterC it's broken for 3 years btw: https://issues.dlang.org/show_bug.cgi?id=20737

Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
Hi, It's common knowledge that accessing tls global is slow http://david-grs.github.io/tls_performance_overhead_cost_linux/ What i do not understand is the reasoning behind choosing tls global by default in D What i find even more weird is writing fast code is ugly in D Look at this ugly

How to debug and watch globals in windows debugger?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
I tried to look around, what ever i try, nothing works There is a mention of "fully qualified" here: https://forum.dlang.org/post/peb1jj$tr$1...@digitalmars.com But what does that mean? I tried this: ![screenshot](https://i.imgur.com/JZooIic.pngg) But it doesn't work

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 19:08:32 UTC, Steven Schveighoffer wrote: On 3/26/23 2:07 PM, ryuukk_ wrote: Hi, It's common knowledge that accessing tls global is slow http://david-grs.github.io/tls_performance_overhead_cost_linux/ What i do not understand is the reasoning behind choosing tls

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:29:17 UTC, Nick Treleaven wrote: On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote: What i find even more weird is writing fast code is ugly in D Look at this ugly code ```D __gshared int fast_code_ugly; ``` Because it should be rare that __gshared is

Re: Why are globals set to tls by default? and why is fast code ugly by default?

2023-03-26 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 26 March 2023 at 18:25:54 UTC, Richard (Rikki) Andrew Cattermole wrote: Having TLS by default is actually quite desirable if you like your code to be safe without having to do anything extra. As soon as you go into global to the process memory, you are responsible for

  1   2   3   >