d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Total Noob In C L4i > Ty
Prev12
Add Reply New Topic New Poll
Member
Posts: 9,803
Joined: Jun 28 2005
Gold: 6.67
Jun 9 2012 10:11am
Quote (AbDuCt @ 9 Jun 2012 18:08)
i mean casting the characters as (char) inside the while loop definition. not the other line of code i put in my edit lol.

and yea forgot the '=' on those operators >.>


Yeah, as that was the only change, it's kinda obvious that I was talking about it. Read up on integer promotion, your casting to int or char made no difference at all.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jun 9 2012 10:13am
Quote (KrzaQ2 @ Jun 9 2012 12:11pm)
Yeah, as that was the only change, it's kinda obvious that I was talking about it. Read up on integer promotion, your casting to int or char made no difference at all.


what really lol. ill have to go read on that, i thought it was always mandatory to cast variables into the same type while comparing them or else you get errors.

This post was edited by AbDuCt on Jun 9 2012 10:13am
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jun 9 2012 10:21am
just read up on it. i never new that. is that included with the c99 standard? because that might be why ive encountered errors before because ive always been to lazy to save my project flags to have -std=c99 in it. or maybe the errors was just coder based lol

also good link for anyone interested in what were talking about.

https://www.securecoding.cert.org/confluence/display/seccode/INT02-C.+Understand+integer+conversion+rules
Member
Posts: 9,803
Joined: Jun 28 2005
Gold: 6.67
Jun 9 2012 10:31am
It's been there since the beginning of C, iirc.
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Jun 9 2012 10:35am
Quote (KrzaQ2 @ Jun 9 2012 12:31pm)
It's been there since the beginning of C, iirc.


hmm weird. well the more you know n_n.

actually now that i think of it i think it was erroring because i tried to compare a int vs char without casting it. if i read correctly integer promotion only works when you cast a type. (i just woke up life doesnt make sense lol)
Go Back To Programming & Development Topic List
Prev12
Add Reply New Topic New Poll