Re: static if - unexpected results

2023-06-23 Thread FeepingCreature via Digitalmars-d-learn
On Friday, 23 June 2023 at 18:43:06 UTC, Steven Schveighoffer wrote: It should be a spec change. Change POD to say "type" instead of "struct". The goal of `isPOD` is to determine how careful generic code needs to be to pass the type around, or copy it. Changing it to false implies that it is

Re: How to setup dub project for contributing to a dub package?

2023-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/23 8:23 PM, Ki Rill wrote: It works fine if I add it as a `dub` package, but I want to add the repository so I can modify it, then test it on a new project, and make a PR that improves the package. How do people usually set up their projects for such tasks? 1. git clone to a local d

Re: A couple of questions about arrays and slices

2023-06-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, June 23, 2023 7:02:12 PM MDT Cecil Ward via Digitalmars-d-learn wrote: > I just had a fight with LDC over the following code when I tried > out reserve. I have an associative array that maps strings to > ‘ordinals’ ie uints that are unique, and the compiler hates the > call to reserve.

Re: A couple of questions about arrays and slices

2023-06-23 Thread Cecil Ward via Digitalmars-d-learn
On Thursday, 22 June 2023 at 05:21:52 UTC, Cecil Ward wrote: On Thursday, 22 June 2023 at 01:44:22 UTC, Jonathan M Davis wrote: On Wednesday, June 21, 2023 7:05:28 PM MDT Paul Backus via Digitalmars-d-learn wrote: [...] To add to that, it _has_ to know the element type, because aside from an

Re: How to setup dub project for contributing to a dub package?

2023-06-23 Thread Ki Rill via Digitalmars-d-learn
On Friday, 23 June 2023 at 15:52:44 UTC, Richard (Rikki) Andrew Cattermole wrote: First things first, dcv is added to the dub-registry, so use this. https://code.dlang.org/packages/dcv ```json "dependencies": { "dcv": "~>0.3.0" } ``` For ffmpeg the binding tells you what to add for se

How to read live output from another process ?

2023-06-23 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I am trying to create a program which burns time codes to a video. I am using ffmpeg for this. So far, I can successfully start ffmpeg in another thread and stop it when I need. But I can't read the live outputs from ffmpeg. This is my code. ```d void onBtnBurnClick(Control c, EventArg

Re: static if - unexpected results

2023-06-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/23/23 10:31 AM, FeepingCreature wrote: On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote: Hi Was looking for compile-time detection of a struct variable. However, the following test code gave the two 'FAILS' shown below. Comments? ``` void main() {    import std.stdio : writeln;    i

Re: static if - unexpected results

2023-06-23 Thread DLearner via Digitalmars-d-learn
On Friday, 23 June 2023 at 16:51:16 UTC, Ali Çehreli wrote: On 6/23/23 07:22, DLearner wrote: >`} else static if (__traits(isPOD, typeof(` ~ VarName ~ `))) {` ~ Regardless, you can also use the 'is' expression with the 'struct' keyword. If T is a struct, is (T == struct) that will

Re: static if - unexpected results

2023-06-23 Thread Ali Çehreli via Digitalmars-d-learn
On 6/23/23 07:22, DLearner wrote: >`} else static if (__traits(isPOD, typeof(` ~ VarName ~ `))) {` ~ Regardless, you can also use the 'is' expression with the 'struct' keyword. If T is a struct, is (T == struct) that will produce true at compile time. Ali

Re: static if - unexpected results

2023-06-23 Thread DLearner via Digitalmars-d-learn
On Friday, 23 June 2023 at 15:48:44 UTC, H. S. Teoh wrote: On Friday, 23 June 2023 at 15:22:36 UTC, DLearner wrote: On Friday, 23 June 2023 at 14:31:45 UTC, FeepingCreature wrote: On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote: [...] ``` static assert(__traits(isPOD, int)); // ok. s

Re: How to setup dub project for contributing to a dub package?

2023-06-23 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
First things first, dcv is added to the dub-registry, so use this. https://code.dlang.org/packages/dcv ```json "dependencies": { "dcv": "~>0.3.0" } ``` For ffmpeg the binding tells you what to add for search paths in the lflags directive. https://github.com/ljubobratovicrelja/ffmpeg-

Re: static if - unexpected results

2023-06-23 Thread H. S. Teoh via Digitalmars-d-learn
On Friday, 23 June 2023 at 15:22:36 UTC, DLearner wrote: On Friday, 23 June 2023 at 14:31:45 UTC, FeepingCreature wrote: On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote: [...] ``` static assert(__traits(isPOD, int)); // ok. static assert(__traits(isPOD, byte)); // ok. ``` It's a bug i

Re: static if - unexpected results

2023-06-23 Thread DLearner via Digitalmars-d-learn
On Friday, 23 June 2023 at 14:31:45 UTC, FeepingCreature wrote: On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote: [...] ``` static assert(__traits(isPOD, int)); // ok. static assert(__traits(isPOD, byte)); // ok. ``` It's a bug in either the spec or the compiler. I am using ``` DMD64

How to setup dub project for contributing to a dub package?

2023-06-23 Thread Ki Rill via Digitalmars-d-learn
Recently, I tried to set up `dcv` with `dub` to improve a few things in the library, but I faced some strange issues. When doing `dub add dcv`, it works fine. But when I try to add a local dcv project folder, or a repository, it fails to link the necessary package libraries. Seems like it's on

Re: static if - unexpected results

2023-06-23 Thread FeepingCreature via Digitalmars-d-learn
On Friday, 23 June 2023 at 14:22:24 UTC, DLearner wrote: Hi Was looking for compile-time detection of a struct variable. However, the following test code gave the two 'FAILS' shown below. Comments? ``` void main() { import std.stdio : writeln; import std.traits; string mxnTst(string

static if - unexpected results

2023-06-23 Thread DLearner via Digitalmars-d-learn
Hi Was looking for compile-time detection of a struct variable. However, the following test code gave the two 'FAILS' shown below. Comments? ``` void main() { import std.stdio : writeln; import std.traits; string mxnTst(string VarName) { return `static if (is(typeof(` ~ Var