Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Made WCharacter.h more clear#26

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
pratikpc wants to merge1 commit intoarduino:master
base:master
Choose a base branch
Loading
frompratikpc:master
Open

Made WCharacter.h more clear#26

pratikpc wants to merge1 commit intoarduino:masterfrompratikpc:master

Conversation

pratikpc
Copy link

It's obvious thata == 0 ? false : true is same asa != 0

Also a != 0 looks more clear as a Return Type to a bool function.
It's more easier to understand what it does in this form.
WCharacter.h was full of functions which utiliseda == 0 ? false : true instead of the more easy to reada != 0 which strikes a fine balance between simplicity and readability.

If we are to look at Standard Library Definitions of the various functions used like isdigit,isalpha etc. we find they return 0 when they do not find anything thus makingisdigit(ch) != 0 even more clearer

Added extern C
Given the fact that we are using C Functions and code that is compatible with the C Standard, I added extern C. Extern C is also used in similar C Standard Compatible Arduino header files

guilhermgonzaga reacted with thumbs up emoji
a == 0 ? false : true is same as a != 0Also added extern C
@CLAassistant
Copy link

CLAassistant commentedApr 9, 2021
edited
Loading

CLA assistant check
All committers have signed the CLA.

@@ -22,6 +22,12 @@

#include <ctype.h>

// This Mentions that the following code is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is useless. It only changes how the function names are mangled. Since the functions are not compiled into an object file nor a static library, it doesn't matter if they're extern "C" or not. They're inline, in C++ and in C.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think this is true for anyinline function, since they are not necessarily inlined. In this case, they arealways_inline so it should indeed not matter, but it might be good to still have theextern "C" for good measure (and in case other non-always_inline functions are added later). I would omit the comment here, though, since the meaning/intention ofextern "C" is rather obvious (and can be looked up if not) and I believe it's used without comment elsewhere too.

Copy link
Collaborator

@matthijskooijmanmatthijskooijman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks like a reasonable change to me. As@leg0 suggests,extern "C" is not strictly required, but it doesn't hurt. I can imagine removing the comment about it, though. See also inline comment.

@@ -22,6 +22,12 @@

#include <ctype.h>

// This Mentions that the following code is
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think this is true for anyinline function, since they are not necessarily inlined. In this case, they arealways_inline so it should indeed not matter, but it might be good to still have theextern "C" for good measure (and in case other non-always_inline functions are added later). I would omit the comment here, though, since the meaning/intention ofextern "C" is rather obvious (and can be looked up if not) and I believe it's used without comment elsewhere too.

@aentinger
Copy link
Contributor

Hi@leg0 👋 Can you please sign the CLA?

@leg0
Copy link
Contributor

@aentinger I have already signed it.

@per1234
Copy link
Collaborator

We need@pratikpc to sign the CLA:
https://cla-assistant.io/arduino/ArduinoCore-API?pullRequest=26

pratikpc reacted with thumbs up emoji

@aentinger
Copy link
Contributor

@aentinger I have already signed it.

Mea culpa 😊

@aentinger
Copy link
Contributor

@pratikpc can you please sign it while being logged in via the right email ... likely the email stored in the commit is different from the one you are signed in GitHub.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@leg0leg0leg0 left review comments

@matthijskooijmanmatthijskooijmanmatthijskooijman approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

6 participants
@pratikpc@CLAassistant@aentinger@leg0@per1234@matthijskooijman

[8]ページ先頭

©2009-2025 Movatter.jp