Re: What is the meaning of @future ?

2021-09-17 Thread bauss via Digitalmars-d-learn
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: Hello D community. I was browsing the `__traits` keywords and I found `isFuture` whose descriptions says something about `@future`-annotated variables. [link](https://dlang.org/spec/traits.html#isFuture) I didn't find anything

Re: Is this a compiler aliasing bug?

2021-09-17 Thread ag0aep6g via Digitalmars-d-learn
On 17.09.21 11:44, Chris Katko wrote: bool is_colliding_with(drawable_object_t obj) //was a class member { [...] alias x2 = obj.x; alias y2 = obj.y; alias w2 = obj.w; alias h2 = obj.h; [...]     } Those aliases don't work like you want them to. You can't have

Is this a compiler aliasing bug?

2021-09-17 Thread Chris Katko via Digitalmars-d-learn
I'm debugging some code I wrote back in 2017 and a bounding box collision detection kept giving spurious answers till I resorted to assuming nothing and dumped every variable and alias. I kept getting results like it was checking against itself, and of course, that would result in finding a

Re: Is this a compiler aliasing bug?

2021-09-17 Thread bauss via Digitalmars-d-learn
On Friday, 17 September 2021 at 09:44:53 UTC, Chris Katko wrote: I'm debugging some code I wrote back in 2017 and a bounding box collision detection kept giving spurious answers till I resorted to assuming nothing and dumped every variable and alias. I kept getting results like it was

yet another segfault - array out of bound is not caught by try catch

2021-09-17 Thread seany via Digitalmars-d-learn
I have now this function, as a private member in a Class : double calculate_lineLength( int i) { field.rawData [] * rd; // ignore the details, this works; rd = cast (field.rawData [] *) dataSet; // ignore the details, this works;

Re: GC seems to crash my C-code function

2021-09-17 Thread jfondren via Digitalmars-d-learn
On Friday, 17 September 2021 at 06:27:40 UTC, frame wrote: Thanks, I'm just careful with casting. Does it really allocate from a literal if it's used on the stack only? Is `-vgc` switch reliable? looks to me like it calls ```d // object private U[] _dup(T, U)(scope T[] a) pure nothrow

Re: GC seems to crash my C-code function

2021-09-17 Thread frame via Digitalmars-d-learn
On Friday, 17 September 2021 at 06:58:01 UTC, jfondren wrote: On Friday, 17 September 2021 at 06:27:40 UTC, frame wrote: Thanks, I'm just careful with casting. Does it really allocate from a literal if it's used on the stack only? Is `-vgc` switch reliable? looks to me like it calls ...

Re: GC seems to crash my C-code function

2021-09-17 Thread frame via Digitalmars-d-learn
On Thursday, 16 September 2021 at 18:02:44 UTC, Steven Schveighoffer wrote: Are you sure? Be very pedantic about what C functions do with the data you send it. Sometimes they store it somewhere to use later. Sometimes they expect it to be allocated by the C heap, etc. Without seeing how

Re: How can we view source code that has been generated (say via "static foreach") ?

2021-09-17 Thread Dennis via Digitalmars-d-learn
On Wednesday, 15 September 2021 at 19:59:43 UTC, james.p.leblanc wrote: However, with various combinations of templates, UDAs, and mixins it has not been easy. Apart from -mixin, there's also the undocumented -vcg-ast switch that prints the AST before code generation, showing instantiated

Re: How can we view source code that has been generated (say via "static foreach") ?

2021-09-17 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 16 September 2021 at 04:54:21 UTC, james.p.leblanc wrote: Thank you for your kind response. Wow, at first the large output file from a small test program was a bit surprising .., but actually it is manageable to dig through to find the interesting bits. So, this is quite useful!

Re: yet another segfault - array out of bound is not caught by try catch

2021-09-17 Thread jfondren via Digitalmars-d-learn
On Friday, 17 September 2021 at 11:10:33 UTC, seany wrote: Compile with `dub build --compiler=ldc2 `. this should enable array bound checking options. By default, yes. run `dub -v build --compiler=ldc2` to see the exact commands that dub runs. But should it not be caught by range error

Re: yet another segfault - array out of bound is not caught by try catch

2021-09-17 Thread Nicholas Wilson via Digitalmars-d-learn
On Friday, 17 September 2021 at 11:10:33 UTC, seany wrote: I have now this function, as a private member in a Class : } catch (RangeError er) { I can't remember if you can catch an index OOB error but try `catch (Throwable er)` will work if it is catchable at all and you can

Re: GC seems to crash my C-code function

2021-09-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/17/21 2:27 AM, frame wrote: On Thursday, 16 September 2021 at 18:02:44 UTC, Steven Schveighoffer wrote: Are you sure? Be very pedantic about what C functions do with the data you send it. Sometimes they store it somewhere to use later. Sometimes they expect it to be allocated by the C

Re: What is the meaning of @future ?

2021-09-17 Thread Meta via Digitalmars-d-learn
On Friday, 17 September 2021 at 10:31:34 UTC, bauss wrote: On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote: Hello D community. I was browsing the `__traits` keywords and I found `isFuture` whose descriptions says something about `@future`-annotated variables.