cc: [email protected]
Subject: Re: Problems with (( !b ... )) and bools...
--------
> Hi!
>
> ----
>
> The following example prints the wrong boolean value with
> ast-ksh.2013-07-19 on SuSE 12.3/AMD64/64bit:
> -- snip --
> $ ./arch/linux.i386-64/bin/ksh -c 'bool b=true ; ((
> b=(!b)?(!false):(!true) )) ; printf "%s\n" "$b"'
> true
> -- snip --
>
> AFAIK it should print "false" ...
>
> ----
>
> Bye,
> Roland
>
> --
true and false are not constants so there is no meaning to true and
false unless you create varibles true and false and define them
as 1 and 0.
bool is an enumeration contain the enumeration constants true and
false. This is no different than
enum Color=(red green blue yellow)
There is no meaning to !blue inside an arithmetic expression except
to do ! blue where blue is a variable.
The only operators that recognize enumeriation constants are
== != and =
when the left hand size is an enumeration variable.
My patch allowed
enum_var = expr?var1:var2
to recognize var1 and var2 as possible enumeration constants,
but it does not recognize !var1.
David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users