http://d.puremagic.com/issues/show_bug.cgi?id=3699



--- Comment #4 from ibrahim YANIKLAR <yanik...@gmail.com> 2010-01-13 04:16:19 
PST ---
(In reply to comment #3)
> This fails to follow those guidelines, and introduces silent changes in 
> behavior.

Not silent, by giving a warning message.

But we can solve this problem by several ways.

1) by giving priority to if.

Examples:

if (c1)
  while (c2)
    stmt1
else
  stmt2

will behave like this:

if (c1)
{
  while (c2)
    stmt1
}
else
  stmt2

----------------------

while (c1)
  while (c2)
    stmt1
  else
    stmt2

will behave like this:

while (c1)
{
  while (c2)
    stmt1
  else
    stmt2
}


(2) in addition to (1) it can be standardized by the rule: the outermost else
is belonging to the outermost while. 

Then:

while (c1)
  while (c2)
    stmt1
else
  stmt2

will behave like this:

while (c1)
{
  while (c2)
    stmt1
}
else
  stmt2

(3) in addition to (1) this type of ambiguities (which 'while' 'else' belongs
to) can be forbidden

then this will give an error

while (c1)
  while (c2)
    stmt1
else
  stmt2

(4) using otherwise statement instead of else

while (c1)
  stmt1
otherwise
  stmt2

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to