[vlc-devel] [PATCH] removed some trivial warnings

Toralf Niebuhr niebuhr at niebuhrt.de
Tue Aug 24 22:56:12 CEST 2010


Am 24.08.2010 um 22:04 schrieb Rémi Denis-Courmont:

> Le mardi 24 août 2010 22:37:44 Toralf Niebuhr, vous avez écrit :
>> This patch only removes some warning of unused variables and added some
>> missing return values.
> 
> Unfortunately, returning dummy values after 'assert(0);' can cause "dead code" 
> warnings, at least when assertion and optimization are enabled at the same 
> time.
# test.cpp
#include <cassert>
int main() {
  assert(0);
  return 0;
}

Compiling this with "g++ -o main test.cpp -O3 -Wall" results in no warnings. Running the program shows that the assertion fails, and therefore the code is compiles with optimization and assertion.

> 
> If I have to choose between one warning or another, I will choose the one that 
> does not generate useless machine code.
This should not generate useless machine code in release mode, since this is an easy optimization.
> 
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
> http://fi.linkedin.com/in/remidenis
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list