Thread overview | |||||
---|---|---|---|---|---|
|
July 30, 2017 Static array * scalar is not working for me | ||||
---|---|---|---|---|
| ||||
Attachments:
| The following code is not working for me float[3] f; f[] = abs(f)[] * -1.0f; where abs is a function that returns a float[3]; it complains that f should be attached to some memory. Is it a bug or am I missing something? |
July 30, 2017 Re: Static array * scalar is not working for me | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danni Coy | On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote:
> The following code is not working for me
>
> float[3] f;
> f[] = abs(f)[] * -1.0f;
> where abs is a function that returns a float[3];
>
> it complains that f should be attached to some memory.
>
> Is it a bug or am I missing something?
I cannot reproduce the error with the code you've given. It's either missing some import, or a definition of `abs()`. The one in std.math doesn't accept arrays at all.
|
July 30, 2017 Re: Static array * scalar is not working for me | ||||
---|---|---|---|---|
| ||||
Posted in reply to Danni Coy | On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote:
> The following code is not working for me
>
> float[3] f;
> f[] = abs(f)[] * -1.0f;
> where abs is a function that returns a float[3];
>
> it complains that f should be attached to some memory.
>
> Is it a bug or am I missing something?
This is unimplemented currently and no one cares about it.
You can do:
f[] = abs(f)[];
f[] *= -1;
|
Copyright © 1999-2021 by the D Language Foundation