Re: auto ref function parameter causes that non copyable struct is copied?

2021-11-10 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Tuesday, 9 November 2021 at 19:30:20 UTC, tchaloupka wrote: On Monday, 8 November 2021 at 23:26:39 UTC, tchaloupka wrote: Bug or feature? :) I've reported it in https://issues.dlang.org/show_bug.cgi?id=22498. It doesn't copy. It just destructs the same object twice... Ouch. Change the d

Re: Cannot compile C file using ImportC

2021-11-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/10/21 2:04 AM, rempas wrote: On Tuesday, 9 November 2021 at 13:44:04 UTC, Steven Schveighoffer wrote: It seems like it should work. Figuring out the "lines" for things is really difficult in this expanded format, even though I know why it does that. I think importC should possibly allow

Re: Cannot compile C file using ImportC

2021-11-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/10/21 1:31 AM, rempas wrote: On Tuesday, 9 November 2021 at 19:34:44 UTC, Stefan Koch wrote: What's happening here is that dmd seems to see `free` as function rather than a pointer to a function. changing `static void* (*ppmalloc)(size_t) = malloc;` to `static void* (*ppmalloc)(size_t)

Re: Cannot compile C file using ImportC

2021-11-10 Thread rempas via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 15:06:26 UTC, Steven Schveighoffer wrote: It shouldn't. Perhaps you mean that you get more errors if you fix that situation? A compiler typically has phases where it can error out. This means that it might not get to further errors (or further errors are hap

Re: Cannot compile C file using ImportC

2021-11-10 Thread rempas via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 15:04:35 UTC, Steven Schveighoffer wrote: I'm using the downloaded LDC2 for aarch64. But I'm not building tomld.c that you created, I'm building the reduced example (that I posted). How? What's the difference in your example? How you preprocessed and compil

Re: Cannot compile C file using ImportC

2021-11-10 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 17:38:12 UTC, rempas wrote: On Wednesday, 10 November 2021 at 15:04:35 UTC, Steven Schveighoffer wrote: [...] How? What's the difference in your example? How you preprocessed and compiled? [...] I did! I personally believe that ImportC is the last and on

Re: Cannot compile C file using ImportC

2021-11-10 Thread rempas via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 17:57:50 UTC, Imperatorn wrote: Agreed. But, it must be quite seamless. But if we could get there, yes 🌟 It should be able to compile medium to big libraries. Nobody excepts it to be able to compile GIMP but it should be a able to tomlc99 which is a little

vibed how do I convert form values into a struct automatically?

2021-11-10 Thread Chris Bare via Digitalmars-d-learn
I know I can do this manually by looking at HTTPServerRequest req, but the documentation for registerWebInterface sounds like there's an automatic way to do this. ``` required/> required/> ``` ```d struct Employee { long id; string first_name; @string last_name

Re: vibed how do I convert form values into a struct automatically?

2021-11-10 Thread Chris Bare via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 19:23:44 UTC, Chris Bare wrote: What am I missing? I figured out part of it. In the html input element the name has to be employeeform.first_name. but now I get a different error: Error handling field 'employeeform.id': Missing form field. I tried declaring

Re: Completing C code with D style

2021-11-10 Thread russhy via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote: btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. So I really don't give a damn about allocations .. not one little bit ;-) It's not a good mindset to have Give room for the unexpected, don't burn all of your options ri

Re: Completing C code with D style

2021-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 10, 2021 at 10:17:48PM +, russhy via Digitalmars-d-learn wrote: > On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote: > > btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. So I > > really don't give a damn about allocations .. not one little bit ;-) > > It's no

Re: Completing C code with D style

2021-11-10 Thread Ali Çehreli via Digitalmars-d-learn
On 11/10/21 3:05 PM, H. S. Teoh wrote: > I cannot compile > even simple programs on a low-memory system because the compiler runs > out of memory Did the -lowmem switch help in some cases? Is -betterC any better? ;) Ali

Re: Completing C code with D style

2021-11-10 Thread forkit via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 22:17:48 UTC, russhy wrote: On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote: btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. So I really don't give a damn about allocations .. not one little bit ;-) Having the right mindset helps n

Re: Completing C code with D style

2021-11-10 Thread forkit via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 23:05:06 UTC, H. S. Teoh wrote: On Wed, Nov 10, 2021 at 10:17:48PM +, russhy via Digitalmars-d-learn wrote: On Wednesday, 10 November 2021 at 06:47:32 UTC, forkit wrote: > btw. My pc has 24GB of main memory, and my CPU 8MB L3 cache. > So I really don't give

Re: Completing C code with D style

2021-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 10, 2021 at 03:13:08PM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 11/10/21 3:05 PM, H. S. Teoh wrote: > > > I cannot compile even simple programs on a low-memory system because > > the compiler runs out of memory > > Did the -lowmem switch help in some cases? On my (high

Re: Completing C code with D style

2021-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 10, 2021 at 11:39:40PM +, forkit via Digitalmars-d-learn wrote: [...] > I still remember compiling code on my 286x86 ... talk about low > memory..whoaaah. That's nothing! ;-) When I was a kid, I programmed a computer that had only 48K of RAM (that's 48 *kilo*bytes, not megabytes!)

Re: vibed how do I convert form values into a struct automatically?

2021-11-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On Wednesday, 10 November 2021 at 20:23:07 UTC, Chris Bare wrote: On Wednesday, 10 November 2021 at 19:23:44 UTC, Chris Bare wrote: What am I missing? I figured out part of it. In the html input element the name has to be employeeform.first_name. but now I get a different error: Error handlin

Re: Completing C code with D style

2021-11-10 Thread forkit via Digitalmars-d-learn
On Thursday, 11 November 2021 at 00:11:07 UTC, H. S. Teoh wrote: On Wed, Nov 10, 2021 at 11:39:40PM +, forkit via Digitalmars-d-learn wrote: [...] I still remember compiling code on my 286x86 ... talk about low memory..whoaaah. ... But if you're in a time-constrained inner loop, you do *no

Dub says that there is an invalid semVer format, but I don't see how.

2021-11-10 Thread Ruby The Roobster via Digitalmars-d-learn
# Dub says that there is an invalid semVer format, but I don't see how. [Relevant Package:](https://code.dlang.org/packages/dutils) Recently, I added a new tag: v0.1.2 to the github repo, as well as v0.1.2-rc.1(this was later removed.) Now whenever updating the package, dub gives me this: B

Re: Dub says that there is an invalid semVer format, but I don't see how.

2021-11-10 Thread rikki cattermole via Digitalmars-d-learn
On 11/11/2021 2:13 PM, Ruby The Roobster wrote: Branch ~master: Invalid SemVer format: testing.0.0 Branch ~testing: Invalid SemVer format: testing.0.0 Version 0.1.2: Invalid SemVer format: testing.0.0 testing is a branch. You are using ~>testing for it. To use a branch in the SEMVER is ~bra

Re: Cannot compile C file using ImportC

2021-11-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/10/21 12:38 PM, rempas wrote: On Wednesday, 10 November 2021 at 15:04:35 UTC, Steven Schveighoffer wrote: I'm using the downloaded LDC2 for aarch64. But I'm not building tomld.c that you created, I'm building the reduced example (that I posted). How? What's the difference in your exam

Wrong result with enum

2021-11-10 Thread Salih Dincer via Digitalmars-d-learn
is this a issue, do you need to case? ```d enum tLimit = 10_000; // (1) true result enum wLimit = 100_000; // (2) wrong result void main() { size_t subTest1 = tLimit; assert(subTest1 == tLimit);/* no error */ size_t subTest2 = wLimit; assert(subTest2 == wLimit);/* no er

Re: Wrong result with enum

2021-11-10 Thread zjh via Digitalmars-d-learn
On Thursday, 11 November 2021 at 05:37:05 UTC, Salih Dincer wrote: is this a issue, do you need to case? out of bound.

Re: Wrong result with enum

2021-11-10 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 11 November 2021 at 05:37:05 UTC, Salih Dincer wrote: is this a issue, do you need to case? ```d enum tLimit = 10_000; // (1) true result enum wLimit = 100_000; // (2) wrong result ``` https://dlang.org/spec/enum.html#named_enums Unless explicitly set, default type is int. 1

Re: Cannot compile C file using ImportC

2021-11-10 Thread rempas via Digitalmars-d-learn
On Thursday, 11 November 2021 at 02:03:22 UTC, Steven Schveighoffer wrote: I don't think ImportC is that much of a game changer (you can already make C bindings with quite a small effort, and there are tools to get you 90% there), but a broken/not working ImportC will be a huge drawback to th

"need `this` for `s` of type `char*`" error message

2021-11-10 Thread rempas via Digitalmars-d-learn
After not being able to use ImportC to automatically compile a C library, now I'm trying to do it myself. The library I want to use is [tomlc99](https://github.com/cktan/tomlc99) which is a small C library to parse toml files. Now I compiled the library and I copied the "config.h" file and modi

Re: "need `this` for `s` of type `char*`" error message

2021-11-10 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 11 November 2021 at 07:04:57 UTC, rempas wrote: After not being able to use ImportC to automatically compile a C library, now I'm trying to do it myself. The library I want to use is [tomlc99](https://github.com/cktan/tomlc99) which is a small C library to parse toml files. Now I c

Re: "need `this` for `s` of type `char*`" error message

2021-11-10 Thread Mathias LANG via Digitalmars-d-learn
On Thursday, 11 November 2021 at 07:10:39 UTC, Mathias LANG wrote: [...] Your type definition is wrong: ```D struct toml_datum_t { int ok; union u { toml_timestamp_t* ts; /* ts must be freed after use */ char* s; /* string value. s must be freed after use */ int b; /* bool

Re: "need `this` for `s` of type `char*`" error message

2021-11-10 Thread rempas via Digitalmars-d-learn
On Thursday, 11 November 2021 at 07:15:04 UTC, Mathias LANG wrote: [...] Note that instead of doing this work yourself, I would highly recommend the excellent [dstep](https://github.com/jacob-carlborg/dstep). Fixed formatting (so much for "Fix it for me"). Oh, now it makes sense! Thanks a