FreeBSD Bugzilla – Attachment 15372 Details for
Bug 28555
[PATCH] style(9) isn't explicit about booleans for testing.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 727 bytes, created by
mwm
on 2001-06-30 22:30:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
mwm
Created:
2001-06-30 22:30:01 UTC
Size:
727 bytes
patch
obsolete
>--- /usr/src/share/man/man9/style.9 Fri May 18 07:27:37 2001 >+++ style.9 Sat Jun 30 16:23:34 2001 >@@ -449,14 +449,37 @@ > !(p = f()) > .Ed > .Pp >-Don't use '!' for tests unless it's a boolean, e.g. use >+For tests, always compare the value to the appropriate 0 instead of >+checking it directly, unless the value is a boolean. >+For pointers, use: >+.Bd -literal >+if (p != NULL) >+.Ed >+.Pp >+not >+.PP >+.Bd -literal >+if (!p) >+.Ed >+.Pp >+For other values, use: > .Bd -literal > if (*p == '\e0') > .Ed > .Pp > not > .Bd -literal >-if (!*p) >+if (*p) >+.Ed >+.Pp >+unless the value is a boolean. In that case, use: >+.Bd -literal >+if (p) >+.Ed >+.Pp >+and >+.Bd -literal >+if (!p) > .Ed > .Pp > Routines returning void * should not have their return values cast
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 28555
: 15372