[Issue 24657] 0-sized struct should be rejected in @safe mode

2024-07-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24657 elpenguin...@gmail.com changed: What|Removed |Added CC||elpenguin...@gmail.com --- Comment

[Issue 24657] 0-sized struct should be rejected in @safe mode

2024-07-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24657 Walter Bright changed: What|Removed |Added Keywords||safe --

[Issue 24657] New: 0-sized struct should be rejected in @safe mode

2024-07-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24657 Issue ID: 24657 Summary: 0-sized struct should be rejected in @safe mode Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal

[Issue 24631] Pointer cast allows changing @system field in @safe code

2024-06-26 Thread d-bugmail--- via Digitalmars-d-bugs
s changing @system field in @safe code https://github.com/dlang/dmd/pull/16625 --

[Issue 24631] Pointer cast allows changing @system field in @safe code

2024-06-26 Thread d-bugmail--- via Digitalmars-d-bugs
created dlang/dmd pull request #16625 "Fix Bugzilla 24631 - Pointer cast allows changing @system field in @s…" fixing this issue: - Fix Bugzilla 24631 - Pointer cast allows changing @system field in @safe code https://github.com/dlang/dmd/pull/16625 --

[Issue 24631] Pointer cast allows changing @system field in @safe code

2024-06-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24631 Nick Treleaven changed: What|Removed |Added Keywords||safe --

[Issue 24631] New: Pointer cast allows changing @system field in @safe code

2024-06-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24631 Issue ID: 24631 Summary: Pointer cast allows changing @system field in @safe code Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW

[Issue 22045] Assignment of pointers in union should be @safe, only pointers access are @system

2024-06-26 Thread d-bugmail--- via Digitalmars-d-bugs
Treleaven --- > Either way, the message given by the compiler is wrong Not sure if it changed, but the message now is: safesetunion.d(8): Error: field `Foo.b` cannot access pointers in `@safe` code that overlap other fields --

[Issue 24603] Can copy from non-void array into void[] in safe code

2024-06-16 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/dmd pull request #16584 "Fix Bugzilla 24603 - Can copy from non-void array into void[] in safe…" was merged into master: - f42dc60597bc904bee9b2377877d511f9dae3cf5 by Nick Treleaven: Fix Bugzilla 24603 - Can copy from non-

[Issue 14445] std.net.curl not usable in @safe code

2024-06-14 Thread d-bugmail--- via Digitalmars-d-bugs
Treleaven --- Writing to a `void[]` cannot be @safe: ```d string msg = "Hello world"; auto client = HTTP("dlang.org"); client.onSend = delegate size_t(void[] data) { auto m = cast(void[]) msg; size_t length = m.length > data.length ? data.length : m.length; if

[Issue 24603] Can copy from non-void array into void[] in safe code

2024-06-14 Thread d-bugmail--- via Digitalmars-d-bugs
created dlang/dmd pull request #16584 "Fix Bugzilla 24603 - Can copy from non-void array into void[] in safe…" fixing this issue: - Fix Bugzilla 24603 - Can copy from non-void array into void[] in safe code Deprecate in safe code. https://github.com/dlang/dmd/pull/16584 --

[Issue 24603] Can copy from non-void array into void[] in safe code

2024-06-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24603 Nick Treleaven changed: What|Removed |Added Keywords||safe --

[Issue 24603] Can copy from non-void array into void[] in safe code

2024-06-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24603 Nick Treleaven changed: What|Removed |Added Severity|enhancement |normal --

[Issue 24603] New: Can copy from non-void array into void[] in safe code

2024-06-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24603 Issue ID: 24603 Summary: Can copy from non-void array into void[] in safe code Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity

Re: bool passed by ref, safe or not ?

2024-06-06 Thread Quirin Schroll via Digitalmars-d-learn
); assert(a == 0b); // what actually happens assert(a == 0b1110); // what would be safe } ``` [...] Do I corrupt memory here or not ? Is that a safety violation ? `cast(bool*)` is a safety violation. The only [safe values][1] for a `bool` are 0 (false) and 1 (true

Re: bool passed by ref, safe or not ?

2024-06-05 Thread Basile B. via Digitalmars-d-learn
assert(a == 0b1110); // what would be safe } ``` [...] Do I corrupt memory here or not ? Is that a safety violation ? `cast(bool*)` is a safety violation. The only [safe values][1] for a `bool` are 0 (false) and 1 (true). By creating a `bool*` that points to a different value

Re: bool passed by ref, safe or not ?

2024-06-05 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 09:09:40 UTC, Kagamin wrote: On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote: The only safe values for a `bool` are 0 (false) and 1 (true). AFAIK that was fixed and now full 8-bit range is safe. `cast(bool) someByte` is fine - that doesn't

Re: bool passed by ref, safe or not ?

2024-06-05 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote: The only safe values for a `bool` are 0 (false) and 1 (true). AFAIK that was fixed and now full 8-bit range is safe.

Re: bool passed by ref, safe or not ?

2024-06-05 Thread Dukc via Digitalmars-d-learn
where the situation is unclear. How do `ubytes` other than 1 or 0, when viewed as bools? We probably can't say it's undefined behaviour, since it is allowed in `@safe`. How I would define it, is that it's unspecific behaviour. That is if you have ```D bool* unspecified = cast(bool*) new ubyte

Re: bool passed by ref, safe or not ?

2024-06-04 Thread Olivier Pisano via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 05:15:42 UTC, Olivier Pisano wrote: This is technically not a memory corruption, because as bool.sizeof < int.sizeof, you just write the low order byte of an int you allocated on the stack. It was not an int, it was a ushort. Anyway, what I wrote still applies.

Re: bool passed by ref, safe or not ?

2024-06-04 Thread Olivier Pisano via Digitalmars-d-learn
corruption. Do I corrupt memory here or not ? Is that a safety violation ? The problem is that while setIt() is @safe, your main function is not. So the pointer cast (which is not @safe) is permitted. A bool is a 1 byte type with two possible values : false (0) and true (1). When you set

Re: bool passed by ref, safe or not ?

2024-06-04 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 5 June 2024 at 01:18:06 UTC, Paul Backus wrote: On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote: you have violated the language's safety invariants. ah mais non.

Re: bool passed by ref, safe or not ?

2024-06-04 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote: ```d void main(string[] args) { ushort a = 0b; bool* b = cast(bool*) setIt(*b); assert(a == 0b); // what actually happens assert(a == 0b1110); // what would be safe

Re: bool passed by ref, safe or not ?

2024-06-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote: question in the header, code in the body, execute on a X86 or X86_64 CPU ```d module test; void setIt(ref bool b) @safe { b = false; } void main(string[] args) { ushort a = 0b; bool* b = cast(bool

Re: bool passed by ref, safe or not ?

2024-06-04 Thread rkompass via Digitalmars-d-learn
On Tuesday, 4 June 2024 at 16:58:50 UTC, Basile B. wrote: question in the header, code in the body, execute on a X86 or X86_64 CPU ```d module test; void setIt(ref bool b) @safe { b = false; } void main(string[] args) { ushort a = 0b; bool* b = cast(bool

bool passed by ref, safe or not ?

2024-06-04 Thread Basile B. via Digitalmars-d-learn
question in the header, code in the body, execute on a X86 or X86_64 CPU ```d module test; void setIt(ref bool b) @safe { b = false; } void main(string[] args) { ushort a = 0b; bool* b = cast(bool*) setIt(*b); assert(a == 0b); // what

[Issue 19916] union member access should be un-@safe

2024-06-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19916 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #24 from Nick

Re: Parallel safe associative array?

2024-05-24 Thread mw via Digitalmars-d-learn
https://code.dlang.org/packages/rust_interop_d wrapped: DashMap: is an implementation of a concurrent associative array/hashmap in Rust.

Parallel safe associative array?

2024-05-24 Thread Andy Valencia via Digitalmars-d-learn
be foolish. But this set me searching through the library for a standard Associative Array construct which _is_ thread safe? It didn't jump out at me. I know I can place such a thing within a synchronized class, but I was wondering if there's a standard AA which has the standard usage but is safe w

[Issue 24552] cast to immutable in @safe not rejected

2024-05-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24552 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #1 from Nick

[Issue 24552] New: cast to immutable in @safe not rejected

2024-05-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24552 Issue ID: 24552 Summary: cast to immutable in @safe not rejected Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: accepts-invalid

[Issue 23530] casting immutable away allowed in safe

2024-04-28 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #5 from Dlang Bot --- dlang/dmd pull request #16315 "Fix Bugzilla 24434 - Casting away const with cast() is not a @safe lv…" was merged into master: - c2eac7ce389eb174cfbb96e66ab4fddb1b48a4b2 by Nick Treleaven: Workaround for safe append Fixes Bugz

[Issue 24477] Union access of bool shouldn't be allowed in @safe

2024-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
shouldn't be allowed in `@safe` https://github.com/dlang/dmd/pull/16356 --

[Issue 24477] Union access of bool shouldn't be allowed in @safe

2024-04-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24477 ag0aep6g changed: What|Removed |Added CC||ag0ae...@gmail.com --

[Issue 24477] Union access of bool shouldn't be allowed in @safe

2024-04-01 Thread d-bugmail--- via Digitalmars-d-bugs
--- @dkorpel created dlang/dmd pull request #16356 "Fix bugzilla 24477 - Union access of bool shouldn't be allowed in `@s…" fixing this issue: - Fix bugzilla 24477 - Union access of bool shouldn't be allowed in `@safe` https://github.com/dlang/dmd/pull/16356 --

[Issue 24477] New: Union access of bool shouldn't be allowed in @safe

2024-04-01 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24477 Issue ID: 24477 Summary: Union access of bool shouldn't be allowed in @safe Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: safe

[Issue 24470] Type safe variadic arguments of delegates cause implicit conversion into lazy

2024-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24470 Marcelo Silva Nascimento Mancini changed: What|Removed |Added Status|NEW |RESOLVED

[Issue 24470] New: Type safe variadic arguments of delegates cause implicit conversion into lazy

2024-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24470 Issue ID: 24470 Summary: Type safe variadic arguments of delegates cause implicit conversion into lazy Product: D Version: D2 Hardware: x86 OS: Windows

[Issue 21675] Unsafe aggregate field initializer causes undefined behavior in @safe code

2024-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21675 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #3 from Nick

[Issue 21675] Unsafe aggregate field initializer causes undefined behavior in @safe code

2024-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
nitializer causes undefined behavior in @safe code https://github.com/dlang/dmd/pull/16347 --

[Issue 24098] Safe variable can be initialized from `@system` static constructor.

2024-03-30 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24098 --- Comment #5 from Dlang Bot --- dlang/dlang.org pull request #3789 "[spec/function] Fix Safe Interface definition" was merged into master: - e3fd3f0e5bebb9884e05a1bc9031176a682df365 by Nick Treleaven: [spec] Fix Safe interface defin

[Issue 23530] casting immutable away allowed in safe

2024-03-24 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23530 --- Comment #4 from Dlang Bot --- @ntrel updated dlang/dmd pull request #16315 "Fix Bugzilla 24434 - Casting away const with cast() is not a @safe lv…" fixing this issue: - Workaround for safe append Fixes Bugzilla 23530 - casting immu

How use SafeRefCounted in @safe code safely?

2024-03-23 Thread kdevel via Digitalmars-d-learn
```d @safe: void foo () { import std.typecons : SafeRefCounted; SafeRefCounted!int s; } unittest { import std.exception : assertNotThrown; assertNotThrown (foo); } ``` ``` $ dmd -unittest -main -run sr.d sr.d(6): Error: `@safe` function `sr.foo` cannot call `@system` destructor

[Issue 24098] Safe variable can be initialized from `@system` static constructor.

2024-03-23 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24098 --- Comment #4 from Dlang Bot --- @ntrel created dlang/dlang.org pull request #3789 "[spec] Fix Safe interface definition" mentioning this issue: - [spec] Fix Safe interface definition 1. Mention context and globals for preconditio

[Issue 24098] Safe variable can be initialized from `@system` static constructor.

2024-03-22 Thread d-bugmail--- via Digitalmars-d-bugs
clearly it violates requirement 1 and the preconditions hold (the > preconditions do not say anything about the state of global variables). Yes, I think the preconditions need to mention safe context: > When it is only called with safe values and safe aliasing --

[Issue 22944] Hard-to-read error message when a delegate isn't @safe

2024-02-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22944 anonymous4 changed: What|Removed |Added Hardware|x86_64 |All OS|Linux

[Issue 22944] Hard-to-read error message when a delegate isn't @safe

2024-02-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=22944 anonymous4 changed: What|Removed |Added Keywords||diagnostic --

[Issue 18110] most of phobos should be @safe-ly useable

2024-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
on||24391 Referenced Issues: https://issues.dlang.org/show_bug.cgi?id=24391 [Issue 24391] std.encoding.sanitize should be usable in @safe --

[Issue 24391] std.encoding.sanitize should be usable in @safe

2024-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
://issues.dlang.org/show_bug.cgi?id=18110 [Issue 18110] most of phobos should be @safe-ly useable --

[Issue 24391] New: std.encoding.sanitize should be usable in @safe

2024-02-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24391 Issue ID: 24391 Summary: std.encoding.sanitize should be usable in @safe Product: D Version: D2 Hardware: x86 OS: All Status: NEW Severity: enhancement

Re: NuMem - safe(r) nogc memory managment

2024-01-03 Thread Guillaume Piolat via Digitalmars-d-announce
/automem I'm not familiar with automem, and I'm not numem primary author. Goals seems very similar and from a cursory reading: - automem is much further along on many points such as: attribute forwarding, @nogc, @safe, DIP1000, allocator support, ranges, support for GC roots, and exists since 6 years

Re: NuMem - safe(r) nogc memory managment

2024-01-02 Thread Sergey via Digitalmars-d-announce
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote: NuMem 0.5.4 has been released, numem is a new library Any meaningful comparison with another similar library will be highly appreciated https://code.dlang.org/packages/automem

Re: NuMem - safe(r) nogc memory managment

2023-12-30 Thread IGotD- via Digitalmars-d-announce
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote: We plan to add more memory management utilities, thereby making writing completely GC-less D code a lot more user-friendly. I'd be happy to help What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a

Re: NuMem - safe(r) nogc memory managment

2023-12-30 Thread Guillaume Piolat via Digitalmars-d-announce
On Saturday, 30 December 2023 at 16:36:38 UTC, ryuukk_ wrote: What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a good and minimalistic Allocator API, i modeled mine around zig's, no RAII, just a simple struct with 3 function ptr FWIW it's possible to do a

Re: NuMem - safe(r) nogc memory managment

2023-12-30 Thread ryuukk_ via Digitalmars-d-announce
We plan to add more memory management utilities, thereby making writing completely GC-less D code a lot more user-friendly. I'd be happy to help What D really is missing _right now_, and will hopefully get _before_ phobosv3 is a good and minimalistic Allocator API, i modeled mine around

Re: NuMem - safe(r) nogc memory managment

2023-12-30 Thread ryuukk_ via Digitalmars-d-announce
Nice, thanks for sharing, it'll be very useful for the C++ developers who want to give D a try

Re: NuMem - safe(r) nogc memory managment

2023-12-30 Thread Guillaume Piolat via Digitalmars-d-announce
On Saturday, 30 December 2023 at 15:17:36 UTC, Luna wrote: * C++ style smart pointers (unique_ptr, shared_ptr, weak_ptr) * C++ style vector type (with support for moving unique_ptr's in!) Indeed with numem you can have a relatively "C++11" experience with scoped ownership, which we intend

NuMem - safe(r) nogc memory managment

2023-12-30 Thread Luna via Digitalmars-d-announce
NuMem 0.5.4 has been released, numem is a new library I am developing with contributions from Auburn Sounds/p0nce. It's meant to provide safer ways of writing nogc code, which is sometimes neccesary when the D garbage collector would be an unoptimal choice. NuMem currently features: * C++

[Issue 24301] [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
assing non-copyable struct by value in @safe code If a copy constructor is explicitly marked with @disable, the error message should mention that, regardless of whether its attributes are allowed in the calling scope. https://github.com/dlang/dmd/pull/15953 --

[Issue 24301] [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
--- @pbackus created dlang/dmd pull request #15953 "Fix 24301 - Misleading error message when passing non-copyable struct…" fixing this issue: - Fix 24301 - Misleading error message when passing non-copyable struct by value in @safe code If a copy constructor is explicitly marked with @disable,

[Issue 24301] [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24301 --- Comment #1 from Paul Backus --- Introduced in this PR: https://github.com/dlang/dmd/pull/14015 --

[Issue 24301] [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24301 Paul Backus changed: What|Removed |Added Keywords||diagnostic --

[Issue 24301] New: [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code

2023-12-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24301 Issue ID: 24301 Summary: [REG 2.100] Misleading error message when passing non-copyable struct by value in @safe code Product: D Version: D2 Hardware: All OS

mysql-native v3.2.0 - the safe update

2023-12-16 Thread aberba via Digitalmars-d-announce
https://forum.dlang.org/post/xozbnrpxmgxboykir...@forum.dlang.org On Tuesday, 14 February 2023 at 14:22:42 UTC, Rey Valeza wrote: On Saturday, 23 April 2022 at 05:12:30 UTC, Steven Schveighoffer wrote: [...] Hi Steve, I just want you to know that I updated the Vibe.d tutorial I wrote last

Re: mysql-native v3.2.0 - the safe update

2023-12-14 Thread aj via Digitalmars-d-announce
On Tuesday, 14 February 2023 at 14:22:42 UTC, Rey Valeza wrote: On Saturday, 23 April 2022 at 05:12:30 UTC, Steven Schveighoffer wrote: [...] Hi Steve, I just want you to know that I updated the Vibe.d tutorial I wrote last year to emphasize database operations using mysql-native and is now

Re: pegged: non@safe semantic actions

2023-12-08 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, December 8, 2023 10:13:21 AM MST Dmitry Ponyatov via Digitalmars-d- learn wrote: > What's wrong with using non@safe actions which creates and > modifies some external objects? > > ```D > class Layer { > int index; > string name; > this(int index,

pegged: non@safe semantic actions

2023-12-08 Thread Dmitry Ponyatov via Digitalmars-d-learn
What's wrong with using non@safe actions which creates and modifies some external objects? ```D class Layer { int index; string name; this(int index, string name) { class SignalLayer : Layer { class UserLayer : Layer { class PCB { Layer[] layer; PT _deflayer(PT)(PT p

[Issue 24275] pragma(mangle, ...) can hijack safe functions, bypassing @safe checks

2023-12-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24275 timon.g...@gmx.ch changed: What|Removed |Added Severity|enhancement |normal --

[Issue 24275] New: pragma(mangle, ...) can hijack safe functions, bypassing @safe checks

2023-12-08 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24275 Issue ID: 24275 Summary: pragma(mangle, ...) can hijack safe functions, bypassing @safe checks Product: D Version: D2 Hardware: x86_64 OS: Linux

Re: iz v0.6.18 - Now with a modern, fast, @safe, getopt-like function

2023-11-16 Thread Basile B. via Digitalmars-d-announce
. - It doesn't use pointers, UDA-ified variable are accessed without intermediary. - It's faster than the phobos one (although getopt is never a bottleneck) - It's `@safe` and can be even `nothrow` It could be easily added to phobos (just need to convert some EnumSet to BitFlag). - code: https

[Issue 20332] associative array clear function should be @safe

2023-11-16 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #2 from Dlang Bot --- dlang/dmd pull request #15817 "Fix 20332 - associative array clear function should be @safe" was merged into master: - f952d190e8fab236c2782c7d04dda58900dfc9ab by Dennis Korpel: Fix 20332 - associative array clear function should be @s

[Issue 20332] associative array clear function should be @safe

2023-11-15 Thread d-bugmail--- via Digitalmars-d-bugs
--- @dkorpel created dlang/dmd pull request #15817 "Fix 20332 - associative array clear function should be @safe" fixing this issue: - Fix 20332 - associative array clear function should be @safe https://github.com/dlang/dmd/pull/15817 --

[Issue 21675] Unsafe aggregate field initializer causes undefined behavior in @safe code

2023-11-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21675 --- Comment #1 from Paul Backus --- This would also be fixed by having the compiler infer S.p as a @system variable based on its initializer. --

[Issue 24225] @safe cast from base type to enum bypasses copy ctor, identity opAssign

2023-11-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24225 Paul Backus changed: What|Removed |Added Keywords||safe --

[Issue 24225] New: @safe cast from base type to enum bypasses copy ctor, identity opAssign

2023-11-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24225 Issue ID: 24225 Summary: @safe cast from base type to enum bypasses copy ctor, identity opAssign Product: D Version: D2 Hardware: All OS: All Status

[Issue 23780] Manual __ctor call can mutate immutable object in @safe code

2023-10-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23780 --- Comment #2 from Paul Backus --- Unfortunately this will probably be tricky to fix, because a lot of valid code gets lowered to `obj.__ctor` internally by the DMD frontend. --

[Issue 24162] Another example of why @safe is broken

2023-10-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 Nick Treleaven changed: What|Removed |Added CC||n...@geany.org --- Comment #8 from Nick

[Issue 24162] Another example of why @safe is broken

2023-09-27 Thread d-bugmail--- via Digitalmars-d-bugs
our intention, like: @safe: import std.stdio: writeln; void f(int x, ref int[] arr) { arr[x] += 1; arr ~= new int[90]; arr[x] += 1; } void main() { auto arr = new int[10]; f(2, arr); writeln(arr[0..10]); } --

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
, and you're allowed to slice those arrays as much as you'd like. And as long as they're slices of GC-allocated memory, it's all memory safe. So, trying to prevent mutable aliasing when it comes to dynamic arrays is not going to work. For better or worse, it's fundamental to how dynamic arrays work in D

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 mhh changed: What|Removed |Added CC||maxha...@gmail.com --- Comment #5 from mhh --- This

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
ive. > accessing this memory location no longer does what it was meant to do. @safe is about preventing memory corruption, not bugs in general. The compiler can't know what the intention of memory is, it just looks at size and lifetime. Only if your reference becomes a dangling pointer or out of bounds in

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 --- Comment #3 from Jonathan M Davis --- There is nothing undefined about this. I suggest that you read this article: https://dlang.org/articles/d-array-article.html --

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 --- Comment #2 from tomerfil...@gmail.com --- suppose this function runs in a long living thread. so what you're saying is, it will be leaked forever because the GC will see it's pointed by a stack location? fine. but surely that's undefined

[Issue 24162] Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 Jonathan M Davis changed: What|Removed |Added CC||issues.dl...@jmdavisprog.co

[Issue 24162] New: Another example of why @safe is broken

2023-09-26 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24162 Issue ID: 24162 Summary: Another example of why @safe is broken Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority

[Issue 20634] @safe forces bounds checking on newly allocated array when using .ptr

2023-09-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20634 --- Comment #4 from Nick Treleaven --- Note: The second commit was wrongly included in that pull and has been removed. --

[Issue 20634] @safe forces bounds checking on newly allocated array when using .ptr

2023-09-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20634 --- Comment #3 from Dlang Bot --- @ntrel updated dlang/dmd pull request #15572 "Fix Issue 24135 - Eponymous template member overloads not shown as call candidates" fixing this issue: - Fix Issue 20634 - @safe forces bounds checkin

[Issue 23530] casting immutable away allowed in safe

2023-09-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23530 Nick Treleaven changed: What|Removed |Added Keywords||safe CC

[Issue 23530] casting immutable away allowed in safe

2023-09-10 Thread d-bugmail--- via Digitalmars-d-bugs
ualifier list) when applied to an lvalue. The first rule was not enforced by dmd. The second rule contradicts the point of the first rule. It should be updated to work in the same way. Fixes Issue 23530 - casting immutable away allowed in safe. https://github.com/dlang/dmd/pull/15597 --

[Issue 20634] @safe forces bounds checking on newly allocated array when using .ptr

2023-09-06 Thread d-bugmail--- via Digitalmars-d-bugs
created dlang/dmd pull request #15581 "Allow using .ptr in @safe code when pointer is safe to dereference" fixing this issue: - Fix Issue 20634 - @safe forces bounds checking on newly allocated array when using .ptr Also allow for any string literal. https://github.com/dlang/dmd/pull/15581 --

[Issue 24098] Safe variable can be initialized from `@system` static constructor.

2023-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24098 --- Comment #2 from timon.g...@gmx.ch --- I think the program is still at odds with the language specification even if requirement 2 is not considered to be violated, because clearly it violates requirement 1 and the preconditions hold (the

[Issue 24098] Safe variable can be initialized from `@system` static constructor.

2023-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24098 --- Comment #1 from timon.g...@gmx.ch --- Actually, depending on how exactly you interpret "create unsafe values", I guess my `main` function may not violate requirement 2. However, I think this is still a problem for memory safety in D and worth

[Issue 24098] New: Safe variable can be initialized from `@system` static constructor.

2023-08-22 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=24098 Issue ID: 24098 Summary: Safe variable can be initialized from `@system` static constructor. Product: D Version: D2 Hardware: All OS: All Status: NEW

[Issue 19916] union member access should be un-@safe

2023-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19916 Issue 19916 depends on issue 20655, which changed state. Issue 20655 Summary: [REG: 2.072] attribute inference accepts unsafe union access as @safe https://issues.dlang.org/show_bug.cgi?id=20655 What|Removed

[Issue 20655] [REG: 2.072] attribute inference accepts unsafe union access as @safe

2023-08-03 Thread d-bugmail--- via Digitalmars-d-bugs
|--- |FIXED --- Comment #9 from Dlang Bot --- dlang/dmd pull request #14827 "fix issue 20655 - attribute inference accepts unsafe union access as @safe" was merged into master: - f55247d8c7fc3d7cf26dbbe34f03708515a5272b by Dennis Korpel: Fix 20655 - attribute inference accepts un

Re: Why is GC.collect not @safe?

2023-08-02 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 2 August 2023 at 13:27:50 UTC, Steven Schveighoffer wrote: On 8/2/23 7:40 AM, Nick Treleaven wrote: Presumably an allocation like `new T` (for a type with a @safe constructor) can be made anywhere a call to `GC.collect` can be made, which may trigger a collection. So why isn't

Re: Why is GC.collect not @safe?

2023-08-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/2/23 7:40 AM, Nick Treleaven wrote: Presumably an allocation like `new T` (for a type with a @safe constructor) can be made anywhere a call to `GC.collect` can be made, which may trigger a collection. So why isn't `GC.collect` marked @safe? It should be. Maybe historical reasons? One

Re: looking for recommendation: which thread safe logger library?

2023-07-12 Thread mw via Digitalmars-d-learn
On Wednesday, 12 July 2023 at 09:47:26 UTC, Danilo wrote: On Wednesday, 12 July 2023 at 05:27:27 UTC, mw wrote: But what's wrong with my code? the strange compiler error? Might be a bug/issue in the logger module. `sharedLog` uses the `shared` attribute, but the base class for everything

Re: looking for recommendation: which thread safe logger library?

2023-07-12 Thread Danilo via Digitalmars-d-learn
WebFreak said you can just use trace(), info() etc. inside threads. It is thread-safe by default. ```d module app; import std.stdio; import std.logger; void main() { //auto file = File("logFile.log", "w"); auto file = stderr; // stdout sharedLog = cast(shared

Re: looking for recommendation: which thread safe logger library?

2023-07-12 Thread Danilo via Digitalmars-d-learn
On Wednesday, 12 July 2023 at 05:27:27 UTC, mw wrote: But what's wrong with my code? the strange compiler error? Might be a bug/issue in the logger module. `sharedLog` uses the `shared` attribute, but the base class for everything ("abstract class Logger") does not use the `shared` attribute

  1   2   3   4   5   6   7   8   9   10   >