D - BUG ? Conditional expression - string
- Ant (18/18) Oct 09 2003 void main()
- J C Calvarese (6/33) Oct 10 2003 I noticed this same bug back in February:
- Charles Sanders (4/37) Oct 10 2003 This is very scary! Whats the word on what this could be ?
-
Walter
(3/4)
Oct 13 2003
It's a bug, and I'm working on fixing it
.
void main()
{
char[] s1 = false ? "yes" : "no";
printf("s1 = >%.*s<\n",s1);
char[] s2 = true ? "yes" : "no";
printf("s2 = >%.*s<\n",s2);
char[] s3 = false ? "no" : "yes";
printf("s3 = >%.*s<\n",s3);
char[] s4 = true ? "no" : "yes";
printf("s4 = >%.*s<\n",s4);
}
output:
s1 = >no<
s2 = >ye< <<<--- expected 'yes'
s3 = >yes<
s4 = >no<
oops?
Ant
Oct 09 2003
Ant wrote:
void main()
{
char[] s1 = false ? "yes" : "no";
printf("s1 = >%.*s<\n",s1);
char[] s2 = true ? "yes" : "no";
printf("s2 = >%.*s<\n",s2);
char[] s3 = false ? "no" : "yes";
printf("s3 = >%.*s<\n",s3);
char[] s4 = true ? "no" : "yes";
printf("s4 = >%.*s<\n",s4);
}
output:
s1 = >no<
s2 = >ye< <<<--- expected 'yes'
s3 = >yes<
s4 = >no<
oops?
Ant
I noticed this same bug back in February:
http://www.digitalmars.com/drn-bin/wwwnews?D/11108
Incidently, I think your example is a lot better than mine was. (My code
word-wrapped all over the place.)
Justin
Oct 10 2003
This is very scary! Whats the word on what this could be ? C "J C Calvarese" <jcc7 cox.net> wrote in message news:bm7c2t$1pq9$1 digitaldaemon.com...Ant wrote:void main() { char[] s1 = false ? "yes" : "no"; printf("s1 = >%.*s<\n",s1); char[] s2 = true ? "yes" : "no"; printf("s2 = >%.*s<\n",s2); char[] s3 = false ? "no" : "yes"; printf("s3 = >%.*s<\n",s3); char[] s4 = true ? "no" : "yes"; printf("s4 = >%.*s<\n",s4); } output: s1 = >no< s2 = >ye< <<<--- expected 'yes' s3 = >yes< s4 = >no< oops? AntI noticed this same bug back in February: http://www.digitalmars.com/drn-bin/wwwnews?D/11108 Incidently, I think your example is a lot better than mine was. (My code word-wrapped all over the place.) Justin
Oct 10 2003
"Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bm7c9t$1q0c$1 digitaldaemon.com...This is very scary! Whats the word on what this could be ?It's a bug, and I'm working on fixing it <g>.
Oct 13 2003








"Walter" <walter digitalmars.com>