]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Avoid warning about possibly unitialized variable.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 6 Oct 2000 14:28:26 +0000 (14:28 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 6 Oct 2000 14:28:26 +0000 (14:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@3397 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-7/step-7.cc

index e2e35aec01f51823aa7dced0db636b96efe05fd2..819a6f7ec3a6940ef475123d11f9747140ccb239 100644 (file)
@@ -1528,11 +1528,21 @@ void LaplaceProblem<dim>::run ()
                                   // output. For example, if you give
                                   // ``2'', this leads to 4 cells in
                                   // 2D and 8 cells in 3D. For
-                                  // quadratic elements, two sub-cells
-                                  // per space direction is obviously
-                                  // the right choice, so this is
-                                  // what we choose:
-  unsigned int n_subcells;
+                                  // quadratic elements, two
+                                  // sub-cells per space direction is
+                                  // obviously the right choice, so
+                                  // this is what we choose (note
+                                  // that the variable is initialized
+                                  // anyway to avoid an error message
+                                  // about possible use without
+                                  // initialization in optimized
+                                  // mode, where the compiler does
+                                  // not abort the program in the
+                                  // second `else' clause; however,
+                                  // the value in the initialization
+                                  // is such that it should be
+                                  // invalid):
+  unsigned int n_subcells = static_cast<unsigned int>(-1);
   if (typeid(*fe) == typeid(const FEQ1<dim>))
     n_subcells = 1;
   else

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.