int count1 = 0, count2 = 0;
if(somecondition)
{
count1 += 1, count1 += ch->level, count2 += 1, count2 = count1 + count1;
return;
}
int count1 = 0, count2 = 0;
if(somecondition)
{
count1 += 1, count1 += ch->level, count2 += 1, count2 = count1 + count1;
return;
}
for( ch=char_list, i= 0; ch ; ch = ch->next, ++i )
add(int x, int y) {return x+y;}
int main() {
int i;
printf("%d",add(5, (i =7 , i+4)));
return 0;
}
void xx() {
int toto = 2;
int titi = 3;
titi *= 2, TRUE;
}
}
#include <stdio.h>
int xx() {
int toto = 2;
int titi = 3;
toto = titi *= 2, 99;
printf("toto %d, titi %d\n",toto,titi);
toto = (titi *= 2, 99);
printf("toto %d, titi %d\n",toto,titi);
return titi, 66;
}
int main() {
printf("return - %d\n",xx());
return 0;
}
W_ERROR = -Werror
W_ANSI = #-pedantic
W_UBER = -Wall
W_FORMAT = -Wformat -Wformat-security -Wmissing-format-attribute
W_MESSY = -Wmissing-braces -Wparentheses -Wshadow -Wredundant-decls
W_TYPE = -Wcast-qual -Wcast-align -Wchar-subscripts -Wreturn-type -Wswitch -Wwrite-strings
W_EXTRA = -Wunused -Wuninitialized #-Wunreachable-code
W_NITPICK = -Wpointer-arith -Winline
ifeq ($(CC), gcc)
W_CONLY = -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
endif
W_FLAGS = $(W_ERROR) $(W_ANSI) $(W_UBER) $(W_FORMAT) $(W_MESSY) $(W_TYPE) $(W_EXTRA) $(W_NITPICK) $(W_CONLY)
int main(int argc, char *argv[]) {
float gain = 4.0;
gain *= 0,75;
return 0;
}
$ clang++ comma.cpp
comma.cpp:3:12: warning: expression result unused [-Wunused-value]
gain *= 0,75;
^~
1 warning generated.
gain *= 0,75; // gain is put to zero whatever gain value.. I was wtf, casting it in double etc etc till I realised it was a , instead of .
(I am french so we use , for numbers, that is kind of why it took me a while to spot it as well)
Thing is, I thought that by activating most (if not all)of the warnings the compiler would catch this kind of thing. Did I miss some ?
I do not even understand why it compiles, I have no idea you could use a ',' like that, and I am wondering what it is supposed to do as well.