Skip to content

Documentation: please mention the type of return functions. #11648

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

Closed
rin67630 opened this issue Aug 14, 2021 · 9 comments
Closed

Documentation: please mention the type of return functions. #11648

rin67630 opened this issue Aug 14, 2021 · 9 comments
Assignees
Labels
Component: Documentation Related to Arduino's documentation content Type: Duplicate Another item already exists for this topic

Comments

@rin67630
Copy link

rin67630 commented Aug 14, 2021

The documentation of Functions should IMHO at least mention the type of the returned parameter(s).

E.g: https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/length/

Returns

The length of the String in characters.

As what?
Integer, Byte, unsigned Integer?

Why isn't that mentioned?

How do you react on that error using the Arduino documentation?

error: format '%u' expects a matching 'unsigned int' argument [-Werror=format=]
         Console2.printf("\nTry conn' to %s (%u) , %s (%u) \n", ssid.c_str(), ssid.length(), pass.c_str()), pass.length();

Thank you for considering my request for the benefit of everybody.

@rin67630
Copy link
Author

P.S. I have found my error in the preceding example, it was a misplaced parenthesis, not a type problem.

Nevertheless the request remains: please always indicate the type of the returned parameters in the documentation.

@per1234 per1234 added the Component: Documentation Related to Arduino's documentation content label Aug 15, 2021
@mahendra1290
Copy link

mahendra1290 commented Sep 1, 2021

hi @per1234 Can I help into this?

@kengdahl
Copy link
Member

So I asked about this and this is one answer I got:

So the c++ function strlen() returns the value as an unsigned int , so I would make a guess that it is the same.

Does this make sense?

@per1234
Copy link
Collaborator

per1234 commented Dec 13, 2021

@kengdahl there is no need to guess. Just consult the source code.

In this case, it is here:
https://github.com/arduino/ArduinoCore-API/blob/1.3.1/api/String.h#L94
and here:
https://github.com/arduino/ArduinoCore-avr/blob/1.8.4/cores/arduino/WString.h#L81
(the Arduino AVR Boards platform does not use ArduinoCore-API, so it is necessary to check its bundled core library)

@kengdahl
Copy link
Member

Ok.

Then I'm going to change it to say:
"The length of the String in characters as an unsigned int."

@kengdahl
Copy link
Member

This should be fixed now.

It now says:
The length of the String in characters. Data type: unsigned int.

@per1234
Copy link
Collaborator

per1234 commented Dec 21, 2021

@kengdahl it is not fixed. The "e.g." meant that this was only one example of the many places where the Arduino reference pages do not document the return type of a function.

There must be a comprehensive review of all Arduino Language Reference and Library Reference content and the return type documented everywhere in order to resolve this deficiency.

We already have a dedicated issue for doing that in the Arduino Language Reference: arduino/reference-en#15 so we can consider this issue to be exclusively for the library reference content. Since that content is spread out across many repositories, this issue tracker (which serves as a bit of a "catch-all" in addition to being for the Arduino IDE 1.x code base) is a reasonable place to store the issue.

@per1234 per1234 reopened this Dec 21, 2021
@kengdahl
Copy link
Member

@per1234 Sorry. I misunderstood this. Good that you opened it again.

@per1234 per1234 added Component: Documentation Related to Arduino's documentation content and removed Component: Documentation Related to Arduino's documentation content labels Jul 17, 2022
@per1234
Copy link
Collaborator

per1234 commented Jul 17, 2022

I see we have another report about this at #4706.

It is best to have only a single issue per subject so we can consolidate all relevant discussion to one place, so I'll go ahead and close this in favor of the other.

If you end up with additional information to share, feel free to comment in the other thread.

@per1234 per1234 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2022
@per1234 per1234 assigned per1234 and unassigned kengdahl Jul 17, 2022
@per1234 per1234 added the Type: Duplicate Another item already exists for this topic label Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Documentation Related to Arduino's documentation content Type: Duplicate Another item already exists for this topic
Projects
None yet
Development

No branches or pull requests

4 participants