Mercurial > hg > octave-terminal
changeset 3366:abdd5ed1bb4e
[project @ 1999-11-20 04:09:20 by jwe]
author | jwe |
---|---|
date | Sat, 20 Nov 1999 04:09:21 +0000 |
parents | 7ed630f7b7be |
children | 0748b03c3510 |
files | doc/interpreter/stmt.txi src/ChangeLog src/parse.y |
diffstat | 3 files changed, 72 insertions(+), 67 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/stmt.txi +++ b/doc/interpreter/stmt.txi @@ -192,67 +192,7 @@ using the indentation to show how Octave groups the statements. @xref{Functions and Scripts}. -@defvr {Built-in Variable} warn_assign_as_truth_value -If the value of @code{warn_assign_as_truth_value} is nonzero, a -warning is issued for statements like - -@example -if (s = t) - ... -@end example - -@noindent -since such statements are not common, and it is likely that the intent -was to write - -@example -if (s == t) - ... -@end example - -@noindent -instead. - -There are times when it is useful to write code that contains -assignments within the condition of a @code{while} or @code{if} -statement. For example, statements like - -@example -while (c = getc()) - ... -@end example - -@noindent -are common in C programming. - -It is possible to avoid all warnings about such statements by setting -@code{warn_assign_as_truth_value} to 0, but that may also -let real errors like - -@example -if (x = 1) # intended to test (x == 1)! - ... -@end example - -@noindent -slip by. - -In such cases, it is possible suppress errors for specific statements by -writing them with an extra set of parentheses. For example, writing the -previous example as - -@example -while ((c = getc())) - ... -@end example - -@noindent -will prevent the warning from being printed for this statement, while -allowing Octave to warn about other assignments used in conditional -contexts. - -The default value of @code{warn_assign_as_truth_value} is 1. -@end defvr +@DOCSTRING(warn_assign_as_truth_value) @node The switch Statement, The while Statement, The if Statement, Statements @section The @code{switch} Statement @@ -351,10 +291,7 @@ using a jump table. @end itemize -@defvr {Built-in Variable} warn_variable_switch_label -If the value of this variable is nonzero, Octave will print a warning if -a switch label is not a constant or constant expression -@end defvr +@DOCSTRING(warn_variable_switch_label) @node The while Statement, The for Statement, The switch Statement, Statements @section The @code{while} Statement
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 1999-11-19 John W. Eaton <jwe@bevo.che.wisc.edu> + * parse.y (Vwarn_assign_as_truth_value, Vwarn_variable_switch_label): + Texinfoize doc strings. + * DLD-FUNCTIONS/pinv.cc (Fpinv): Texinfoize doc string. * defun-int.h (DEFUN_DLD_INTERNAL): New macro.
--- a/src/parse.y +++ b/src/parse.y @@ -3354,7 +3354,68 @@ results of commands executed by eval() that do not end with semicolons."); DEFVAR (warn_assign_as_truth_value, 1.0, warn_assign_as_truth_value, - "produce warning for assignments used as truth values"); + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} warn_assign_as_truth_value\n\ +If the value of @code{warn_assign_as_truth_value} is nonzero, a\n\ +warning is issued for statements like\n\ +\n\ +@example\n\ +if (s = t)\n\ + ...\n\ +@end example\n\ +\n\ +@noindent\n\ +since such statements are not common, and it is likely that the intent\n\ +was to write\n\ +\n\ +@example\n\ +if (s == t)\n\ + ...\n\ +@end example\n\ +\n\ +@noindent\n\ +instead.\n\ +\n\ +There are times when it is useful to write code that contains\n\ +assignments within the condition of a @code{while} or @code{if}\n\ +statement. For example, statements like\n\ +\n\ +@example\n\ +while (c = getc())\n\ + ...\n\ +@end example\n\ +\n\ +@noindent\n\ +are common in C programming.\n\ +\n\ +It is possible to avoid all warnings about such statements by setting\n\ +@code{warn_assign_as_truth_value} to 0, but that may also\n\ +let real errors like\n\ +\n\ +@example\n\ +if (x = 1) # intended to test (x == 1)!\n\ + ...\n\ +@end example\n\ +\n\ +@noindent\n\ +slip by.\n\ +\n\ +In such cases, it is possible suppress errors for specific statements by\n\ +writing them with an extra set of parentheses. For example, writing the\n\ +previous example as\n\ +\n\ +@example\n\ +while ((c = getc()))\n\ + ...\n\ +@end example\n\ +\n\ +@noindent\n\ +will prevent the warning from being printed for this statement, while\n\ +allowing Octave to warn about other assignments used in conditional\n\ +contexts.\n\ +\n\ +The default value of @code{warn_assign_as_truth_value} is 1.\n\ +@end defvr"); DEFVAR (warn_function_name_clash, 1.0, warn_function_name_clash, "produce warning if function name conflicts with file name"); @@ -3367,7 +3428,11 @@ terminated with a semicolon"); DEFVAR (warn_variable_switch_label, 0.0, warn_variable_switch_label, - "produce warning for variables used as switch labels"); + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} warn_variable_switch_label\n\ +If the value of this variable is nonzero, Octave will print a warning if\n\ +a switch label is not a constant or constant expression\n\ +@end defvr"); }