ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Суббота
8 ноября
1552861 Топик полностью
framer (Вчера, 22:55, просмотров: 57) ответил IBAH на у меня пример не открывается
кусок кода 

uint32_t cnt = 10;

unsigned short t0 = 1;

unsigned short pt = 8;

if (cnt - t0 >= pt) {

printf("Bum!!!");

}



это с флагами -Wall -Wextra -Wconversion -Wsign-conversion

а вот что будет если заменить unsigned short t0 -> short t0

~/temp$ gcc -Wall -Wextra -Wconversion -Wsign-conversion -Wdouble-promotion -Wfloat-conversion test.cpp -o test

test.cpp: In function ‘int main()’:

test.cpp:11:15: warning: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]

11 | if (cnt - t0 >= pt) {

| ^~