changeset 12477:d1466d956d17

Add a warning description for Matlab-style short-circuiting
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Fri, 25 Feb 2011 12:07:11 -0600
parents 070214996fba
children b4138a75eecc
files scripts/ChangeLog scripts/miscellaneous/warning_ids.m
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Thu Feb 24 20:22:38 2011 -0500
+++ b/scripts/ChangeLog	Fri Feb 25 12:07:11 2011 -0600
@@ -1,3 +1,8 @@
+2011-02-25  Jordi GutiƩrrez Hermoso  <jordigh@gmail.com>
+
+	* miscellaneous/warnings_ids.m: Add a warning description for
+	Matlab-style short-circuiting
+
 2011-02-24  Ben Abbott  <bpabbott@mac.com>
 
 	* plot/subplot.m: Document using INDEX as a vector.
--- a/scripts/miscellaneous/warning_ids.m	Thu Feb 24 20:22:38 2011 -0500
+++ b/scripts/miscellaneous/warning_ids.m	Fri Feb 25 12:07:11 2011 -0600
@@ -188,6 +188,27 @@
 ## elicits a warning if the @code{Octave:num-to-str} warning is
 ## enabled.  By default, the @code{Octave:num-to-str} warning is enabled.
 ##
+## @item Octave:possible-matlab-short-circuit-operator
+## If the @code{Octave:possible-matlab-short-circuit-operator} warning
+## is enabled, Octave will warn about using the not short circuiting
+## operators @code{&} and @code{|} inside @code{if} or @code{while}
+## conditions. They normally never short circuit, but @sc{Matlab} always
+## short circuits if any logical operators are used in a condition. You
+## can turn on the option
+##
+## @example
+## @group
+## do_braindead_shortcircuit_evaluation(1)
+## @end group
+## @end example
+##
+## @noindent
+## if you would like to enable this short-circuit evaluation in
+## Octave. Note that the @code{&&} and @code{||} operators always short
+## circuit in both Octave and @sc{Matlab}, so it's only necessary to
+## enable @sc{Matlab}-style short-circuiting it's too arduous to modify
+## existing code that relies on this behaviour.
+##
 ## @item Octave:precedence-change
 ## If the @code{Octave:precedence-change} warning is enabled, Octave
 ## will warn about possible changes in the meaning of some code due to