Skip to content

Add unsigned int/long type casting pages #530

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

Merged
merged 2 commits into from
Jun 11, 2019
Merged

Add unsigned int/long type casting pages #530

merged 2 commits into from
Jun 11, 2019

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Feb 6, 2019

  • Use C-like type casting syntax in existing cast pages for consistence, since this syntax is required for unsigned int/long
  • Add unsigned int/long type casting pages

@cmaglie
Copy link
Member

cmaglie commented Jun 11, 2019

I'd like to keep the Arduino-style byte(..), may we keep both alternatives? maybe adding a note to the new one like:

= byte(x)
= (byte)(x)   (C++ type conversion)

also word now looks a bit weird because it has the helper with two arguments:

(word)x
word(h, l)

if we keep all the alternatives it will become:

word(x)
word(h, l)
(word)(x)    (C++ type conversion)

per1234 added 2 commits June 11, 2019 07:53
In addition to the existing documentation of functional notation, add documentation of the C-like notation as well. This will bring some consistency with the the documentation for the casts to multi-word types (e.g., unsigned int).
I'm not certain whether casting pages for all the types in the reference should be added, but certainly it must be demonstrated that casting can be done to the multi-word types as well. unsigned int/unsigned long are important types, so at a minimum these must be added.

Likely it would have been best to write a single generic page on type casting but we took the other fork in the road too long ago to turn back now.
@per1234
Copy link
Collaborator Author

per1234 commented Jun 11, 2019

Thanks for the feedback @cmaglie! I have made the requested change of documenting both casting styles (giving preference to functional notation) via a force push. You can see it in this commit:
c847bd1

@per1234 per1234 merged commit d1c3ecc into arduino:master Jun 11, 2019
@per1234 per1234 deleted the unsigned-int-long-cast branch June 25, 2019 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants