Thread overview
BUG ? Conditional expression - string
Oct 10, 2003
Ant
Oct 10, 2003
J C Calvarese
Oct 10, 2003
Charles Sanders
Oct 14, 2003
Walter
October 10, 2003
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


October 10, 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

October 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?
> >
> > 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
>


October 14, 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>.