Files
oldlinux-files/Ref-docs/POSIX/susv3/functions/xsh_chap02_01.html
2024-02-19 00:21:47 -05:00

64 lines
2.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>System Interfaces Chapter 2</title>
</head>
<body>
<basefont size="3">
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001</font></center>
<hr size="2" noshade>
<h3><a name="tag_02_01"></a>Use and Implementation of Functions</h3>
<p>Each of the following statements shall apply unless explicitly stated otherwise in the detailed descriptions that follow:</p>
<ol>
<li>
<p>If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the
address space of the program, or a null pointer), the behavior is undefined.</p>
</li>
<li>
<p>Any function declared in a header may also be implemented as a macro defined in the header, so a function should not be declared
explicitly if its header is included. Any macro definition of a function can be suppressed locally by enclosing the name of the
function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function
name. For the same syntactic reason, it is permitted to take the address of a function even if it is also defined as a macro. The
use of the C-language <b>#undef</b> construct to remove any such macro definition shall also ensure that an actual function is
referred to.</p>
</li>
<li>
<p>Any invocation of a function that is implemented as a macro shall expand to code that evaluates each of its arguments exactly
once, fully protected by parentheses where necessary, so it is generally safe to use arbitrary expressions as arguments. Likewise,
those function-like macros described in the following sections may be invoked in an expression anywhere a function with a
compatible return type could be called.</p>
</li>
<li>
<p>Provided that a function can be declared without reference to any type defined in a header, it is also permissible to declare
the function explicitly and use it without including its associated header.</p>
</li>
<li>
<p>If a function that accepts a variable number of arguments is not declared (explicitly or by including its associated header),
the behavior is undefined.</p>
</li>
</ol>
<hr size="2" noshade>
<center><font size="2">UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
</font> [ <a href="../mindex.html">Main Index</a>]</center>
<hr size="2" noshade>
</body>
</html>