You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
xdr_destroy and XDR_CONTROL are defined as "if" statements in xdr.h, but they should be expressions.
#define xdr_destroy(xdrs)
if ((xdrs)->x_ops->x_destroy)
(*(xdrs)->x_ops->x_destroy)(xdrs)
As an "if" statement, xdr_destroy() can't appear in the increment clause of a "for" statement:
for (cond; test; xdr_destroy(xp)) { ... } // syntax error
Much worse, it can cause unexpected results when used within an if statement. Consider:
if (cond)
xdr_destroy(xdrs);
else
oops();
If xdrs->x_ops->x_destroy is NULL, then oops() will be called, which is not what the programmer would expect.
The text was updated successfully, but these errors were encountered:
xdr_destroy and XDR_CONTROL are defined as "if" statements in xdr.h, but they should be expressions.
#define xdr_destroy(xdrs)
if ((xdrs)->x_ops->x_destroy)
(*(xdrs)->x_ops->x_destroy)(xdrs)
As an "if" statement, xdr_destroy() can't appear in the increment clause of a "for" statement:
for (cond; test; xdr_destroy(xp)) { ... } // syntax error
Much worse, it can cause unexpected results when used within an if statement. Consider:
if (cond)
xdr_destroy(xdrs);
else
oops();
If xdrs->x_ops->x_destroy is NULL, then oops() will be called, which is not what the programmer would expect.
The text was updated successfully, but these errors were encountered: