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

2023-10-13 Thread rempas via Digitalmars-d-learn
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!

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

2023-10-13 Thread rempas via Digitalmars-d-learn
On Tuesday, 10 October 2023 at 16:11:57 UTC, bachmeier wrote: Which part uses Phobos? The linked function compiles without importing anything. Actually, you are right. I didn't give a lot of thought to it, as there is the line `char[] ret = new char[](length);` but I can replace it with an

Re: use dmd for bare metal i386

2023-10-13 Thread Adam D Ruppe 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. Make an empty file called object.d in your build directory t

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

use dmd for bare metal i386

2023-10-13 Thread Dmitry Ponyatov via Digitalmars-d-learn
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

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

2023-10-13 Thread Nick Treleaven via Digitalmars-d-learn
On Tuesday, 10 October 2023 at 11:45:25 UTC, Dennis wrote: ```D enum itoa(int i) = i.stringof; static foreach(i; 0 .. 10) { mixin(create_fn!(itoa!i)); } ``` You can also do it using a string mixin: mixin(create_fn!(mixin("`", i, "`"))); I think that's equivalent to `i.stringof` anyway.

Re: dlang.org/spec/function.html#pure-functions example

2023-10-13 Thread Nick Treleaven via Digitalmars-d-learn
On Thursday, 12 October 2023 at 19:33:32 UTC, Paul wrote: If **int x** is global mutable state, what does static mutable state look like? In addition to Jonathan's reply, see: https://dlang.org/spec/function.html#local-static-variables

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