Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable random number functionality for non-AVR boards #73

Closed
Pharap opened this issue Mar 25, 2021 · 0 comments · Fixed by #74
Closed

Disable random number functionality for non-AVR boards #73

Pharap opened this issue Mar 25, 2021 · 0 comments · Fixed by #74
Assignees
Labels
Feature Request This issue is a request for a particular feature Patch This change is an unobtrusive change
Milestone

Comments

@Pharap
Copy link
Owner

Pharap commented Mar 25, 2021

Originally I believed random() to originate from Arduino because Arduino defines several overloads of random(), but I have since learned that the zero-parameter version of random() originates from avr-libc.

Despite learning this a long time ago, I haven't made an attept to rectify FixedPoints' behaviour in regard to this issue until now.

This issue proposes that rather than testing for specific non-AVR processors, a better approach for handling the random number issue (for now) is to define FIXED_POINTS_NO_RANDOM if the target processor is not an AVR target, or more specifically if __AVR__ is not defined. Hence:

#if !defined(__AVR__)
#define FIXED_POINTS_NO_RANDOM
#endif

There is a slight chance that this may break the library for boards that provide random() but do not identify as AVR, but I expect this to be an exceptionally rare occurance. In comparison the number of boards that this library could compile for but won't because of the fixed point issue is becoming increasingly notable.

Rather than end up with a long list of issues requesting that a board be supported, it makes more sense to simply assume a target doesn't support random() and provide support for all the other features of the library.

@Pharap Pharap self-assigned this Mar 25, 2021
@Pharap Pharap added this to the v1.0.8 milestone Mar 25, 2021
@Pharap Pharap added Feature Request This issue is a request for a particular feature Patch This change is an unobtrusive change labels Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is a request for a particular feature Patch This change is an unobtrusive change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant