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

allow str in subroutine signature #69

Closed
irmen opened this issue Oct 21, 2021 · 1 comment
Closed

allow str in subroutine signature #69

irmen opened this issue Oct 21, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@irmen
Copy link
Owner

irmen commented Oct 21, 2021

Currently you can use str only in asmsub signature, for regular subroutines the compiler gives an error about that reference types should be an uword.

examples/test.p8:10:0: ERROR Pass-by-reference types (str, array) cannot occur as a parameter type directly. Instead, use an uword to receive their address, or access the variable from the outer scope directly.

This should be fixed so that str can be used in signature .
(The issue is related to the way subroutine params are treated as local variables.)

Ideally we do the same for array types but that's a different issue, one that is difficult to solve because the compiler now treats array vars as a direct (name) reference to the array in memory. Passing different arrays in the place of an array var can't be done right now.

@irmen irmen added the enhancement New feature or request label Oct 21, 2021
@irmen
Copy link
Owner Author

irmen commented Oct 25, 2021

(Fixed in 7.2)

@irmen irmen changed the title allow str (and array type as well?) in subroutine signature allow str in subroutine signature Oct 27, 2021
@irmen irmen closed this as completed Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant