Home > Back-end >  The presence of strong symbol conversion issues
The presence of strong symbol conversion issues

Time:01-09

CodePudding user response:

The problem is not cast out of the question, but when you send the single-byte as arguments to the printf, compiler extends to it (longer), for many reasons, I didn't look too,

CodePudding user response:

Is the inside of the printf format to character, the first 250 good understanding, use unsigned char casts after 11111010 is 250, and no longer need to complement, because is unsigned types,
The second is the % u, for % d is - 6, with the second floor,

CodePudding user response:

So,
The first step, like the original poster written in the annotations,
Second step into the stack extensions (to 32-bit integer times), the front of the unsigned add 0, signed in front of all a copy of the sign bit,
The third step in accordance with the requirements of the format character received explained after the extension of the content, the output,

CodePudding user response:

The
reference 3 floor forever74 response:
so,
The first step, like the original poster written in the annotations,
Second step into the stack extensions (to 32-bit integer times), the front of the unsigned add 0, signed in front of all a copy of the sign bit,
The third step in accordance with the requirements of the format character received explained after the extension of the content, the output,

So if the second step is a symbol of a negative number, the location of the front extension are all level 1?

CodePudding user response:

Yes, that's what I mean.

CodePudding user response:

reference 5 floor forever74 reply:
yes, that's what I mean.

But, here, why will have equal
Printf (" % u \ n ", (char) ~ 5==4294967290).//output 1

CodePudding user response:

reference 5 floor forever74 reply:
yes, that's what I mean.

Is not strongly convert the char types

CodePudding user response:

reference 5 floor forever74 reply:
yes, that's what I mean.

Printf (" % u \ n ", (char) ~ 5==4294967290).//output 1 here, and not have strong into a char, why still equal, extends the have taken place here?

CodePudding user response:


Printf (" % u \ n ", (char) ~ 5==4294967290) this sentence clearly 0, not 1
(char) ~ 5==4294967290 this is a comparison, the result is false, 0 when printed

CodePudding user response:

CodePudding user response:

This sentence on my VS2017 generate an error

CodePudding user response:

Even if the compiler so so don't mention this, operator before the operation force level lower operand is not normal operation?

CodePudding user response:

This is the compilation environment problems

CodePudding user response:

The
references to the tenth floor truth is right or wrong response:

You send me have a look at this url

CodePudding user response:

In my opinion, the corresponding assembly instruction and will never be able to thoroughly understand,

CodePudding user response:

jsrun.net

CodePudding user response:

The
reference 14 floor, I was the youngest boy reply:
Quote: reference to the tenth floor truth is right or wrong response:

You send me have a look at the url

Is not only the website, you use vs is 0

CodePudding user response:

reference 16 floor truth is right or wrong response:
jsrun.net

On both sides of the output, this should be the compiler

CodePudding user response:


Dev is 0

CodePudding user response:

references the 19th floor truth is right or wrong response:

Dev is 0

I am using vc6.0

CodePudding user response:

The building Lord you attention point is slanting, you attempt to use a wrong way to verify problems at the beginning, and then under the guidance of our mistake itself more walk more far,
Come back, don't forget the beginner's mind,
  • Related