answersLogoWhite

0

Warnings and errors are both errors in C++, but warnings won't prevent your program from compiling, whereas errors will. Some warnings may be unavoidable in the interest of optimising performance, but so long as they do not affect the program's operations they can often be ignored. For instance, casting an unsigned char to a signed char has potential for loss of data if the unsigned char is greater than 127, and is therefore an unsafe cast. But if you can assert the cast is safe then the warning can be ignored. The alternative would be to cast to a larger type (such as casting to a signed short), but this might result in large changes to your program where a signed char is expected. As programmer, you are free to decide whether the warning really should be treated as an error, or if the warning can be safely ignored with prudent assertions instead.

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions