Re: How to properly use variadic templates (functions)?

2021-12-21 Thread Anonymouse via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 06:44:36 UTC, rempas wrote: This will not do for me because I want to do formatted output and I need the index. But thanks a lot for tying to help! I'm not certain I understand, but won't `foreach (i, a; args) { /* ... */ }` in his example do that? As in, if

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 08:11:39 UTC, Anonymouse wrote: I'm not certain I understand, but won't `foreach (i, a; args) { /* ... */ }` in his example do that? As in, if you necessarily must index `args` instead of using a foreach variable, ```d import core.stdc.stdio : putc, stdout;

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread vit via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 08:26:17 UTC, rempas wrote: On Tuesday, 21 December 2021 at 08:11:39 UTC, Anonymouse wrote: I'm not certain I understand, but won't `foreach (i, a; args) { /* ... */ }` in his example do that? As in, if you necessarily must index `args` instead of using a

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 10:28:15 UTC, eugene wrote: filed an issue, see https://issues.dlang.org/show_bug.cgi?id=22615 Nice! Hope they see and fix it soon! Love for open source Operating Systems!!

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 15:42:59 UTC, russhy wrote: Please keep us updated, that'll be interesting to see how a pure D printf would look like! Glad someone is interested! I'm actually planning to make a whole library ;) Check my

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread russhy via Digitalmars-d-learn
Please keep us updated, that'll be interesting to see how a pure D printf would look like!

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread Johan via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 10:28:15 UTC, eugene wrote: On Monday, 20 December 2021 at 21:19:43 UTC, rempas wrote: I would recommend you to file an [issue](https://issues.dlang.org/) just so the developers themself can notice it. filed an issue, see

Re: Thread exits immediately with no reason.

2021-12-21 Thread Dennis via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 07:08:53 UTC, bauss wrote: It should at the very least warn people about functions that may throw errors. What is "It"? I was looking to make a spec PR, but it already says here: https://dlang.org/spec/function.html#nothrow-functions Nothrow functions can

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Monday, 20 December 2021 at 21:19:43 UTC, rempas wrote: I would recommend you to file an [issue](https://issues.dlang.org/) just so the developers themself can notice it. filed an issue, see https://issues.dlang.org/show_bug.cgi?id=22615

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 08:42:35 UTC, vit wrote: You can use switch + static foreach: ```d import std.stdio; //this print args in reverse order: void print(T...)(string prompt, T args) { void print_arg(size_t index){ switch(index){

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
I would love to see more full (and correct) support for FreeBSD, OpenBSD and DragonflyBSD from Dlang! Maybe one day..

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 18:42:10 UTC, rempas wrote: I'm wondering what happens in the latest LDC2 version. Your version is from 1 year and 4 months ago. Well, I just installed it by pkg intstall ldc Actually, this is my first experience with FreeBSD, I did not have much to go

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:13:19 UTC, Steven Schveighoffer wrote: On 12/21/21 1:50 PM, eugene wrote: ```d     version (FreeBSD_12) enum __FreeBSD_version = 1202000; else version (FreeBSD_11) enum __FreeBSD_version = 1104000; else version (FreeBSD_10) enum __FreeBSD_version = 1004000;

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread russhy via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 18:51:38 UTC, Stanislav Blinov wrote: On Tuesday, 21 December 2021 at 15:42:59 UTC, russhy wrote: Please keep us updated, that'll be interesting to see how a pure D printf would look like! It already exists, it's called std.format.write.formattedWrite, in

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread Johan via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 21:09:14 UTC, eugene wrote: On Tuesday, 21 December 2021 at 21:02:21 UTC, rempas wrote: On Tuesday, 21 December 2021 at 19:55:13 UTC, eugene wrote: core/sys/freebsd/config.d and core/sys/freebsd/sys/event.d are the same as in fresh dmd, so there is not much

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/21/21 4:28 AM, rempas wrote: On Tuesday, 21 December 2021 at 08:42:35 UTC, vit wrote: You can use switch + static foreach: ```d import std.stdio;     //this print args in reverse order:     void print(T...)(string prompt, T args)     {     void print_arg(size_t index){    

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote: Please add which compiler(s) you have tried in the bug report. Yeah, you are right! Please eugene use LDC2 and check confirm that the behavior is the same there. I think the fix is needed here:

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:00:04 UTC, eugene wrote: Well, I just installed it by pkg intstall ldc Actually, this is my first experience with FreeBSD, I did not have much to go deeper. That's nice trying new things ;) Oh, no, sorry. :) It is the problem of FreeBSD maintainers

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:49:26 UTC, Steven Schveighoffer wrote: If this is a compiler-supplied version, then I don't think you are allowed to set it explicitly. moreover... commented out in condig.d like this: ```d version (FreeBSD_12) enum __FreeBSD_version = 1202000; //else

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 21:02:21 UTC, rempas wrote: On Tuesday, 21 December 2021 at 19:55:13 UTC, eugene wrote: core/sys/freebsd/config.d and core/sys/freebsd/sys/event.d are the same as in fresh dmd, so there is not much sense to try it. dmd (including phobos) is a reference, and I

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 01:13:10 UTC, Ali Çehreli wrote: I bet it's throwing an Error. Call your thread entry function from a try-catch wrapping function to see whether that's the case: // Rename existing function: protected void audioThreadImpl() @nogc nothrow { // ... } // New

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:32:44 UTC, rempas wrote: On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote: Please add which compiler(s) you have tried in the bug report. Yeah, you are right! Please eugene use LDC2 and check confirm that the behavior is the same there. I have.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 18:28:12 UTC, rempas wrote: I would love to see more full (and correct) support for FreeBSD, OpenBSD and DragonflyBSD from Dlang! Maybe one day.. My interest was kqueue facility. I use linux epoll facility a lot in my progs, and just wanted to do some exersises

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 18:35:43 UTC, eugene wrote: LDC2 stdlib does not have correct struct event_t for 12+ in /usr/local/include/d/core/sys/freebsd/sys/event.d at all, only for earlier versions, ie without extension field. DMD stdlib does have, the only problem is the OS version is

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:40:52 UTC, eugene wrote: But i like to use software out of the box and do not like compile it from source. Me too! The link I gave you has a binary release with LDC2. You won't have to compile it yourself. I do not see any reason for me to do this. The

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:32:44 UTC, rempas wrote: Please eugene use LDC2 and check confirm that the behavior is the same there. Phobos that shipped with LDC, does not have core.sys.freebsd.config So ```d import std.stdio; //import core.sys.freebsd.config; import

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:32:44 UTC, rempas wrote: Yeah, you are right! Please eugene use LDC2 and check confirm LDC2 stdlib does not have correct struct event_t for 12+ in /usr/local/include/d/core/sys/freebsd/sys/event.d at all, only for earlier versions, ie without extension field.

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 15:42:59 UTC, russhy wrote: Please keep us updated, that'll be interesting to see how a pure D printf would look like! It already exists, it's called std.format.write.formattedWrite, in terms of which things like std.stdio.writef are implemented.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote: I think the fix is needed here: https://github.com/dlang/dmd/blob/ad8412530e607ffebec36f2dbdff1a6f2798faf7/src/dmd/target.d#L362-L372 looks like this. it is a little bit strange, that in /usr/include/d/dmd/core/sys/freebsd/config.d

Re: Thread exits immediately with no reason.

2021-12-21 Thread Ali Çehreli via Digitalmars-d-learn
On 12/21/21 10:07 AM, solidstate1991 wrote: > I couldn't add those lines unfortunately, Perhaps I had typos? Or the code is not yours to modify? In any case, you should be able to introduce a top level thread entry function and put the try-catch in there. > but I do get an exception in a >

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/21/21 1:50 PM, eugene wrote: On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote: I think the fix is needed here: https://github.com/dlang/dmd/blob/ad8412530e607ffebec36f2dbdff1a6f2798faf7/src/dmd/target.d#L362-L372 looks like this. it is a little bit strange, that in

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:22:35 UTC, rempas wrote: On Tuesday, 21 December 2021 at 19:00:04 UTC, eugene wrote: Well, I just installed it by pkg intstall ldc Actually, this is my first experience with FreeBSD, I did not have much to go deeper. That's nice trying new things ;)

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:22:35 UTC, rempas wrote: Yeah, don't use the "pkg" version as it is outdated. It is very hard to keep a whole OS (thousands of packages) up to date. So yeah, uninstall your current ldc and trying with the one from the link I gave you and tell me the output

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:55:13 UTC, eugene wrote: core/sys/freebsd/config.d and core/sys/freebsd/sys/event.d are the same as in fresh dmd, so there is not much sense to try it. dmd (including phobos) is a reference, and I do not think, that ldc is ahead of dmd with it's stdlib.

Re: Thread exits immediately with no reason.

2021-12-21 Thread solidstate1991 via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 19:00:01 UTC, solidstate1991 wrote: Well, it seems like it's an error on the WASAPI side. I totally disabled error handling (including the switch-case thingy), then GetBuffer returns with an error code indicating buffer is too large. The solution was to call

Re: How to properly use variadic templates (functions)?

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:33:09 UTC, Steven Schveighoffer wrote: The reason your original isn't working is that indexing a list of differently-typed things cannot be done using a runtime index. I'd say that an inner function + static foreach + switch is the best way to convert

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread eugene via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 17:00:06 UTC, Johan wrote: On Tuesday, 21 December 2021 at 10:28:15 UTC, eugene wrote: On Monday, 20 December 2021 at 21:19:43 UTC, rempas wrote: I would recommend you to file an [issue](https://issues.dlang.org/) just so the developers themself can notice it.

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/21/21 2:32 PM, eugene wrote: On Tuesday, 21 December 2021 at 19:13:19 UTC, Steven Schveighoffer wrote: On 12/21/21 1:50 PM, eugene wrote: ```d version (FreeBSD_12) enum __FreeBSD_version = 1202000; else version (FreeBSD_11) enum __FreeBSD_version = 1104000; else version (FreeBSD_10)

Re: FreeBSD 13 : wrong kernel version and size of kevent_t

2021-12-21 Thread rempas via Digitalmars-d-learn
On Tuesday, 21 December 2021 at 21:09:14 UTC, eugene wrote: * The ldc installed by 'pkg install ldc' (the old one), does not have config module * Most resent ldc (link you indicated), does have condig module, and it is exactly the same as condig in most recent dmd Cool! Makes sense! I