Ask coding questions

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

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

AllAwesome497 (397)

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

SPQR (591)

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

abc3354 (227)

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

PS : small typo on first line 'unsined'

ArtyomKey (0)

@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 (227)

@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 !