Ask coding questions

← Back to all posts
How I can enable a warnings about types transformation
ArtyomKey

unsigned int size;
....
for(int i = 0; i < size; i++){
.......
}
but "size" has an "unsigned int" type! How to be? is there a warning? How to switch on

Voters
ArtyomKey
Comments
hotnewtop
AllAwesome497

@ArtyonKey What language is this (coding/programing language? Also type in your native language, I'll use google translate

SPQR

@AllAwesome497 he's supposed to type in English, it's part of the guidelines here (also I think it's C++)

AllAwesome497

@SPQR oh :/

abc3354

I think the best thing is to use a 'unsigned int' in your loop.

PS : small typo on first line 'unsined'

ArtyomKey

@abc3354 if it is not mine code? I don't want to find other mistakes. I thing the best compiler like Repl can notify me about this warning.

abc3354

@ArtyomKey So, final answer

I tried your code.
To get a warning you need to use the compilation flag -Wall
Unfortunately, you cannot set a compiler option on replit (this is planned here and asked here

There is an other option (which I call the magic option) :
Open the command palette (right-click > command palette), type open shell, and then you can compile yourself with g++ -Wall main.cpp

Hope this will help !