D - odd error
- Mårten Ask (12/12) Aug 16 2003 Why doesn't this code work? I'm using dmd 0.69. It worked with 0.68..
- Mike Wynn (5/17) Aug 16 2003 "H" is a char[1] s[0] is a char
- Mårten Ask (4/26) Aug 16 2003 Thanks, it worked right away with single quotes. I feel stupid. :)
- Matthew Wilson (2/3) Aug 17 2003 Don't feel stupid. Feel her smarter older sister!
- John Reimer (1/3) Aug 17 2003 Well! You know how to fix that! LOL
Why doesn't this code work? I'm using dmd 0.69. It worked with 0.68.. void main() { char[] s = "Hello"; if(s[0] == "H") { printf(s); } } I get: hello.d(4): incompatible types for ((cast(int)(s[0])) == ("H")): 'int' and 'char[1]'
Aug 16 2003
"H" is a char[1] s[0] is a char try 'H' (char literal, not string literal) or "H"[0] ! there has been a change \n is not '\n' and 'foo' is not a string anymore. "Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bhm5nk$7jf$1 digitaldaemon.com...Why doesn't this code work? I'm using dmd 0.69. It worked with 0.68.. void main() { char[] s = "Hello"; if(s[0] == "H") { printf(s); } } I get: hello.d(4): incompatible types for ((cast(int)(s[0])) == ("H")): 'int' and 'char[1]'
Aug 16 2003
Thanks, it worked right away with single quotes. I feel stupid. :) "Mike Wynn" <mike.wynn l8night.co.uk> skrev i meddelandet news:bhm8d5$bgh$1 digitaldaemon.com..."H" is a char[1] s[0] is a char try 'H' (char literal, not string literal) or "H"[0] ! there has been a change \n is not '\n' and 'foo' is not a string anymore. "Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bhm5nk$7jf$1 digitaldaemon.com...andWhy doesn't this code work? I'm using dmd 0.69. It worked with 0.68.. void main() { char[] s = "Hello"; if(s[0] == "H") { printf(s); } } I get: hello.d(4): incompatible types for ((cast(int)(s[0])) == ("H")): 'int''char[1]'
Aug 16 2003
Thanks, it worked right away with single quotes. I feel stupid. :)Don't feel stupid. Feel her smarter older sister! (Sorry, am a bit low on blood sugar at the moment ...)
Aug 17 2003
(Sorry, am a bit low on blood sugar at the moment ...)Well! You know how to fix that! LOL
Aug 17 2003