[vtk-developers] vtkSmartPointer and gcc -Wunused-variable

Sean McBride sean at rogue-research.com
Wed Nov 24 16:50:34 EST 2010


Hi all,

Consider this simple code:

-------
#include "vtkSmartPointer.h"
#include "vtkPolyData.h"

int main (int argc, char *argv[])
{
	(void)argc; (void)argv;
	
	int a = 0;
	vtkSmartPointer<vtkPolyData> polydata = 0;
	
	return 0;
}
-------

Then:

$ gcc -Wunused-variable -I/vtk/include/vtk-5.7 test.cp

test.cp: In function ‘int main(int, char**)’:
test.cp:8: warning: unused variable ‘a’

Notice that gcc does *not* warn that "polydata" is unused, but does for
"a".  I'm curious why that is, and if anyone knows of a way to get gcc
to warn?  (clang also does not warn.)

Cheers,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada


More information about the vtk-developers mailing list