The?AWK?book does not define the return value of?srand(). The?POSIX?standard has it return the seed it was using,to allow keeping track of random number sequences. Therefore?srand()?in?gawk?also returns its current seed.
Other new features are: The use of multiple?-f?options (from MKS?awk); the?ENVIRONarray; the?a,and?v?escape sequences (done originally in?gawk?and fed back into the Bell Laboratories version); the?tolower()?and?toupper()?built-in functions (from the Bell Laboratories version); and the?ANSI?C conversion specifications in?printf?(done first in the Bell Laboratories version).
There are two features of historical?AWK?implementations that?gawk?supports. First,it is possible to call the?length()?built-in function not only with no argument,but even without parentheses! Thus,
a = length??????# Holy Algol 60,Batman!
is the same as either of
a = length()?a = length($0)
This feature is marked as ‘‘deprecated’’ in the?POSIX?standard,and?gawk?issues a warning about its use if?--lint?is specified on the command line.
The other feature is the use of either the?continue?or the?break?statements outside the body of a?while,?for,or?do?loop. Traditional?AWK?implementations have treated such usage as equivalent to the?next?statement.?Gawk?supports this usage if?--traditionalhas been specified.
Gawk?has a number of extensions to?POSIX?awk. They are described in this section. All the extensions described here can be disabled by invoking?gawk?with the?--traditionaloption.
The following features of?gawk?are not available in?POSIX?awk.
Description |
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?x?escape sequence. (Disabled with?--posix.)</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?fflush()?function. (Disabled with?--posix.)</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The ability to continue lines after???and?:. (Disabled with?--posix.)</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">Octal and hexadecimal constants in AWK programs.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?ARGIND,?BINMODE,?ERRNO,?LINT,?RT?and?TEXTDOMAINvariables are not special.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?IGNORECASE?variable and its side-effects are not available.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?FIELDWIDTHS?variable and fixed-width field splitting.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?PROCINFO?array is not available.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The use of?RS?as a regular expression.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The special file names available for I/O redirection are not recognized.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The?|&?operator for creating co-processes.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The ability to split out individual characters using the null string as the value of?FS,and as the third argument to?split().</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The optional second argument to the?close()?function.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The optional third argument to the?match()?function.</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The ability to use positional specifiers with?printf?and?sprintf().</td>
</tr>
<tr valign="top">
<td>o</td>
<td valign="bottom">The use of?delete?array?to delete the entire contents of an array.</td>
(编辑:晋中站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|