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
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletionsapi/WCharacter.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.

// Compatible with Standard C
#ifdef __cplusplus
extern "C" {
#endif

// WCharacter.h prototypes
inline bool isAlphaNumeric(int c) __attribute__((always_inline));
inline bool isAlpha(int c) __attribute__((always_inline));
Expand All@@ -45,73 +51,73 @@ inline int toUpperCase(int c)__attribute__((always_inline));
// It is equivalent to (isalpha(c) || isdigit(c)).
inline bool isAlphaNumeric(int c)
{
return(isalnum(c)== 0 ? false : true);
return isalnum(c)!= 0;
}


// Checks for an alphabetic character.
// It is equivalent to (isupper(c) || islower(c)).
inline bool isAlpha(int c)
{
return(isalpha(c)== 0 ? false : true);
return isalpha(c)!= 0;
}


// Checks whether c is a 7-bit unsigned char value
// that fits into the ASCII character set.
inline bool isAscii(int c)
{
return(isascii(c)== 0 ? false : true);
return isascii(c)!= 0;
}


// Checks for a blank character, that is, a space or a tab.
inline bool isWhitespace(int c)
{
return(isblank(c)== 0 ? false : true);
return isblank(c)!= 0;
}


// Checks for a control character.
inline bool isControl(int c)
{
return(iscntrl(c)== 0 ? false : true);
return iscntrl(c)!= 0;
}


// Checks for a digit (0 through 9).
inline bool isDigit(int c)
{
return(isdigit(c)== 0 ? false : true);
return isdigit(c)!= 0;
}


// Checks for any printable character except space.
inline bool isGraph(int c)
{
return(isgraph(c)== 0 ? false : true);
return isgraph(c)!= 0;
}


// Checks for a lower-case character.
inline bool isLowerCase(int c)
{
return(islower(c)== 0 ? false : true);
return islower(c)!= 0;
}


// Checks for any printable character including space.
inline bool isPrintable(int c)
{
return(isprint(c)== 0 ? false : true);
return isprint(c)!= 0;
}


// Checks for any printable character which is not a space
// or an alphanumeric character.
inline bool isPunct(int c)
{
return(ispunct(c)== 0 ? false : true);
return ispunct(c)!= 0;
}


Expand All@@ -120,22 +126,22 @@ inline bool isPunct(int c)
// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v').
inline bool isSpace(int c)
{
return(isspace(c)== 0 ? false : true);
return isspace(c)!= 0;
}


// Checks for an uppercase letter.
inline bool isUpperCase(int c)
{
return(isupper(c)== 0 ? false : true);
return isupper(c)!= 0;
}


// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7
// 8 9 a b c d e f A B C D E F.
inline bool isHexadecimalDigit(int c)
{
return(isxdigit(c)== 0 ? false : true);
return isxdigit(c)!= 0;
}


Expand DownExpand Up@@ -165,4 +171,9 @@ inline int toUpperCase(int c)
return toupper (c);
}

// End extern C
#ifdef __cplusplus
}
#endif

#endif

[8]ページ先頭

©2009-2025 Movatter.jp