Re: Detect uninitialized class var access

2022-09-24 Thread Tejas via Digitalmars-d-learn
On Saturday, 24 September 2022 at 23:04:00 UTC, rassoc wrote: On 9/24/22 15:28, Adam D Ruppe via Digitalmars-d-learn wrote: gdb --args ./your_program and then it will tell you all the details you want to know about when this happens. Thank you for your input, Adam. Real shame that there's n

Re: Detect uninitialized class var access

2022-09-24 Thread Salih Dincer via Digitalmars-d-learn
On Saturday, 24 September 2022 at 13:17:19 UTC, rassoc wrote: Recently I refactored some old code of mine, now utilizing classes instead structs, and I got hit by an uninitialized variable access pattern similar to the simplified example below. I think changing the structure will make things h

Re: Detect uninitialized class var access

2022-09-24 Thread rassoc via Digitalmars-d-learn
On 9/24/22 15:28, Adam D Ruppe via Digitalmars-d-learn wrote: gdb --args ./your_program and then it will tell you all the details you want to know about when this happens. Thank you for your input, Adam. Real shame that there's no built-in compiler solution and probably never will be accord

Anaphoric "macros"

2022-09-24 Thread Christian Köstlin via Digitalmars-d-learn
Hi, I just stumbled upon anaphoric macros (https://en.wikipedia.org/wiki/Anaphoric_macro) in elisp. Seems that the dlang feature e.g. `map!"a*2"` is something similar to that, although I never read about it phrased like that before. Kind regards, Christian

Re: Detect uninitialized class var access

2022-09-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 24 September 2022 at 13:17:19 UTC, rassoc wrote: just crashes with `Error: program killed by signal 11` on linux and nothing else. gdb --args ./your_program and then it will tell you all the details you want to know about when this happens. strangly sometimes adding the -O opti

Detect uninitialized class var access

2022-09-24 Thread rassoc via Digitalmars-d-learn
Recently I refactored some old code of mine, now utilizing classes instead structs, and I got hit by an uninitialized variable access pattern similar to the simplified example below. How can we easily spot this? What other switches and safeguards are there? > dmd -dip1000 -debug -g -w just cra

Re: Serial communication library

2022-09-24 Thread Arjan via Digitalmars-d-learn
On Saturday, 24 September 2022 at 08:52:42 UTC, Imperatorn wrote: On Thursday, 22 September 2022 at 12:05:00 UTC, Imperatorn wrote: Hi guys! What's the best/preferred library to use for serial communication (RS)? Thanks 🍀 I will give onyx-serial a try Also on code.dlang.org: https://git

Re: Is this a new bug ?

2022-09-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 24 September 2022 at 06:13:55 UTC, test123 wrote: If so please report it for me to bugs platform. I can not register one. ```d package { version(TEST) { static: } else { __gshared: } uint test = 0; } ``` ldmd2 -betterC -vtls -c ./test.d ./test.d

Re: Is this a new bug ?

2022-09-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Saturday, 24 September 2022 at 06:13:55 UTC, test123 wrote: If so please report it for me to bugs platform. This isn't a bug, the effect of keyword: things stop at the matching }. (static if and version don't introduce a namespace scope, but they still follow this rule for the { colon: .

Re: Serial communication library

2022-09-24 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 22 September 2022 at 12:05:00 UTC, Imperatorn wrote: Hi guys! What's the best/preferred library to use for serial communication (RS)? Thanks 🍀 I will give onyx-serial a try

Re: Is this a new bug ?

2022-09-24 Thread test123 via Digitalmars-d-learn
On Saturday, 24 September 2022 at 07:11:12 UTC, rikki cattermole wrote: ```d version(all) { __gshared: uint test2; } uint test; ``` Output with -vtls: ``` Up to 2.079.1: Success with output: onlineapp.d(9): test is thread local Since 2.080.1: Success with output: onlinea

Re: Is this a new bug ?

2022-09-24 Thread rikki cattermole via Digitalmars-d-learn
```d version(all) { __gshared: uint test2; } uint test; ``` Output with -vtls: ``` Up to 2.079.1: Success with output: onlineapp.d(9): test is thread local Since 2.080.1: Success with output: onlineapp.d(9): `test` is thread local ``` Looks fine to me.

Passing D reimplementation of C++ template as argument to a C++ function

2022-09-24 Thread Gregor Mückl via Digitalmars-d-learn
Hi! I have a D template struct that reimplements a C++ class template with identical memory layout for a set of types that matter to me. Now, I want to use some C++ functions and classes that use these template instances, from D. For that, I want to purposefully alias the D and C++ types. How