On 10/12/22 7:46 AM, Dennis wrote:
On Wednesday, 12 October 2022 at 10:09:31 UTC, Steven Schveighoffer wrote:
I'm actually very surprised that just wrapping the statement in an ==
expression doesn't do the trick, what is the possible logic behind
outlawing that?
I looked into it, there are
On 10/12/22 9:17 AM, Rene Zwanenburg wrote:
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven Schveighoffer wrote:
Am I missing something?
Perhaps I am, but why not turn it into a numeric comparison, like:
```
while((i = 5) == 0)
```
Yes, that is the answer, that was eluding me.
What
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven
Schveighoffer wrote:
Am I missing something?
Perhaps I am, but why not turn it into a numeric comparison, like:
```
while((i = 5) == 0)
```
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven
Schveighoffer wrote:
Porting some C code to D
This results in an error:
```d
int x;
while(!(x = 5)) { break; }
```
Error is: assignment cannot be used as a condition, perhaps
`==` was meant?
...
I think D should relax the restriction
On Wednesday, 12 October 2022 at 10:09:31 UTC, Steven
Schveighoffer wrote:
I'm actually very surprised that just wrapping the statement in
an == expression doesn't do the trick, what is the possible
logic behind outlawing that?
I looked into it, there are actually two different places where
On 10/12/22 5:24 AM, Dennis wrote:
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven Schveighoffer wrote:
Porting some C code to D
This results in an error:
I had the same issue, where the pattern was this:
```C
void f()
{
int err;
if (err = some_api_call()) {
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven
Schveighoffer wrote:
Porting some C code to D
This results in an error:
I had the same issue, where the pattern was this:
```C
void f()
{
int err;
if (err = some_api_call()) {
printCode(err);
return;
}
if
Porting some C code to D
This results in an error:
```d
int x;
while(!(x = 5)) { break; }
```
Error is: assignment cannot be used as a condition, perhaps `==` was meant?
OK, fine, I'll use `==`:
```d
int x;
while(!(x = 5) == true) { break; }
```
Nope, same error. I tried reversing the