Re: What does a cast really do?

2025-02-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On Friday, 21 February 2025 at 13:07:38 UTC, Paul Backus wrote: On Friday, 21 February 2025 at 07:44:54 UTC, Jonathan M Davis wrote: I think that what it basically comes down to is that because -1 fits in int, and int implicitly converts to uint, VRP is fine with converting the long with a valu

Re: What does a cast really do?

2025-02-21 Thread Lance Bachmeier via Digitalmars-d-learn
On Friday, 21 February 2025 at 15:48:12 UTC, Steven Schveighoffer wrote: But testing this, it doesn't make sense: ```d uint x = long(-1); // OK uint y = -1L; // Error: cannot implicitly convert expression `-1L` of type `long` to `uint` ``` Surely something here is worthy of a bug report

Re: help with prime pairs code

2025-02-21 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 19 February 2025 at 23:58:09 UTC, Salih Dincer wrote: On Friday, 31 January 2025 at 20:05:54 UTC, Jabari Zakiya wrote: I'm converting Ruby code to D and am running into issues. Would appreciate what needs to be done to get it to compile/run correctly. I removed 1 line in your co

Re: What does a cast really do?

2025-02-21 Thread Paul Backus via Digitalmars-d-learn
On Friday, 21 February 2025 at 07:44:54 UTC, Jonathan M Davis wrote: I think that what it basically comes down to is that because -1 fits in int, and int implicitly converts to uint, VRP is fine with converting the long with a value of -1 to uint. So, as long as the value fits in 32 bits, the c