[Insight-developers] compile warnings in FEM code

Aljaz Noe noe@grasp.cis.upenn.edu
Thu, 20 Dec 2001 17:45:30 -0500


> Globals are bad in general. Can't you provide methods to return
> the same information?

I can and I do. And I would like to eliminate those global variables as well
since they are just references to static class data members. But for some
reason unknown to me MSVC compiler won't initialize the const static class
members, unless they are referenced somewhere. Since the code inside classes
assumes that these static members are initialized since forever (like they
should be), very bad things start to happen if they are not for some reason.
Defining global static references provides a workaround to this problem.

> Warnings aren't harmless because they disguise other warnings
> that may in fact be errors. Like using a variable before it's initialized.

I totally agree. I always like to have 0 warnings code. But I must know how
to get rid of them...

> If you'd like, we can look at the code and come up with some suggestions.

Please do. I'm sure you will quickly see what's going on and how to avoid
the problem.

The easiest solution (AFAIK) would be to create a dummy function, that uses
all those global variables. All warnings should go away immediately. But I'm
sure there are other more elegant ways.

Aljaz


> -----Original Message-----
> From: Aljaz Noe [mailto:noe@grasp.cis.upenn.edu]
> Sent: Thursday, December 20, 2001 9:20 AM
> To: Insight-Developers
> Subject: [Insight-developers] compile warnings in FEM code
>
>
> Hi!
>
> I've managed to bring the FEM code to a point where there are no compile
> errors on all nightly builds.
>
> There are still warnings on Sun machines caleb.-crd and esopus.-crd saying
> that a global variable was defined but never used. This is true.
> We define a
> bunch of global static consts that store ID numbers of classes. And these
> are of course never used in a library.
>
> The warnings are harmless (IMHO) but annoying, because there are a lot of
> them. Any suggestions, how to get rid of them?
>
> Another warning (only one) is within a Doxygen saying that no
> matching class
> member was found and a couple of class members (non-private) are omitted
> from the documentation. When I compiled the documentation on my
> machine with
> Doxygen version 1.2.12, everything was OK. Again, any suggestions?
>
> Aljaz
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>