Bonjour,

Je suis en C++03 et j'ai un code comme ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
// Fonctions de la bibliothèque que j'utilise
virtual uint16_t TextArea::getTextWidth() const;
virtual void Drawable::setX(int16_t x);
virtual void Drawable::setWidth(int16_t width;
 
 
// Creation de mes drawables
Box background_m;
TextArea text_m;
 
 
// Code utilisant tout ce beau monde
enum
{
BACKGROUND_BORDER = 10
};
 
int16_t bw = text_m.getTextWidth() + BACKGROUND_BORDER * 2;
background_m.setX(width / 2 - bw / 2);
background_m.setWidth(bw);
Mon IDE CLion analyses le code à la volée (avec clang j'ai l'impression) et me lève un warning comme ceci sur l'appel à setX():
Warning:(39, 23) Parameter type mismatch: Values of type 'int' may not fit into the receiver type 'int16_t'
Que faire dans pareil cas ?

Merci pour vos conseils !