Re:Android Project Changeset 4f8b683: libc/memset.c
by seliopou on Tuesday May 25, 2010 @09:15PM
(#1379213)
-Wextra is total insanity. I just compiled some C code I've been working on with that flag, and got the following: "warning: signed and unsigned type in conditional expression." I was testing if a variable I declared as an integer was less than 0. To my knowledge, every number literal in C is assumed to be of a signed type unless followed by a 'u'. But now I know better. 0 is the exception.
Re:Android Project Changeset 4f8b683: libc/memset.c
by swolchok on Tuesday May 25, 2010 @11:02PM
(#1379389)
Are you sure?
$ echo 'int main(int argc, char **argv) { if (argc < 0) { return 1; } else {return 0;}}' > test.c
$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
$ gcc -Wall -Wextra test.c
test.c: In function ‘main’:
test.c:1: warning: unused parameter ‘argv’
$
gcc-4.3.4 behaved the same way in my test.
Re:Android Project Changeset 4f8b683: libc/memset.c
by humbledrone on Tuesday May 25, 2010 @08:32PM
(#1379135)
Yeah, that's why every programmer on the project has to be scrupulous about finding and correcting such errors. That's professionalism 101 -- if your team is not keeping the build warning free, things like this slip through.
Re:Android Project Changeset 4f8b683: libc/memset.c
by tptacek on Tuesday May 25, 2010 @08:56PM
(#1379194)
Things like what, a blatantly obvious bug that would crash virtually every C program running on the system were it not for the fact that it was dead code?
This is practically a documentation bug.
[edit]
I kind of take it back, after mahmud's bzero() joke... out of oniguruma, Python, hexfiend, Apache, nginx, openssl, redis, regexkit, saxon, memcached, subversion, and valgrind, this hypothetical bug would have broken Python, redis, subversion, several apache modules, and memcached. The contents of my codebase/3p directory, FWIW.
Also, unless every programmer on the project is being scrupulous about finding and correcting such errors, it quickly becomes line noise, and a lot of it completely unimportant stuff.