Re: Casting rules

2022-08-26 Thread ag0aep6g via Digitalmars-d-learn
On Friday, 26 August 2022 at 20:42:07 UTC, JG wrote: Where can I find rules about casting. e.g. I assume casting away immutable is undefined behavior (or implementation defined behavior). What about casting to immutable (I would expect at most it only to be allowed if your type has no

Casting rules

2022-08-26 Thread JG via Digitalmars-d-learn
Where can I find rules about casting. e.g. I assume casting away immutable is undefined behavior (or implementation defined behavior). What about casting to immutable (I would expect at most it only to be allowed if your type has no references e.g. ints okay but int[] not etc.) Casting const

Re: is it possible synchronized(null) ? i.e NO-OP

2022-08-26 Thread Ali Çehreli via Digitalmars-d-learn
On the main forum, Paul Backus proposed a nested function as well as a scoped lock. On 8/26/22 10:13, mw wrote: >Object lock = (a particular condition) ? realLock : null; And I want to point out that "a particular condition" must not change between the check above and the following

is it possible synchronized(null) ? i.e NO-OP

2022-08-26 Thread mw via Digitalmars-d-learn
Hi, I haven't tried, but can I do: ``` void foo(lots of params) { Object lock = (a particular condition) ? realLock : null; synchronized(lock) { // lots of complex code block here } } ``` i.e depending on a a particular condition, the complex code block either need to be

Re: how to install the new dmd on Mac M1?

2022-08-26 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/25/22 11:50 PM, MichaelBi wrote: you are right, the package install is OK. but after running dub build --compiler=dmd, the error of "ld: library not found for - lssl" is still there... I've not had problems since updating to the M1, but my system was upgraded through many years, so I