initialize and comment variables that the compiler finds suspicious
authorJonathan L Long <jonlong@cs.berkeley.edu>
Tue, 10 Jun 2014 21:50:24 +0000 (14:50 -0700)
committerEvan Shelhamer <shelhamer@imaginarynumber.net>
Wed, 25 Jun 2014 22:11:41 +0000 (15:11 -0700)
src/caffe/layers/data_layer.cpp
src/caffe/layers/pooling_layer.cpp

index f12ae1c..29c4fec 100644 (file)
@@ -26,7 +26,7 @@ void* DataLayerPrefetch(void* layer_pointer) {
   Datum datum;
   CHECK(layer->prefetch_data_);
   Dtype* top_data = layer->prefetch_data_->mutable_cpu_data();
-  Dtype* top_label;
+  Dtype* top_label = NULL;  // suppress warnings about uninitialized variables
   if (layer->output_labels_) {
     top_label = layer->prefetch_label_->mutable_cpu_data();
   }
index 8f5f82d..ba84ede 100644 (file)
@@ -87,8 +87,8 @@ Dtype PoolingLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
   const int top_count = (*top)[0]->count();
   // We'll output the mask to top[1] if it's of size >1.
   const bool use_top_mask = top->size() > 1;
-  int* mask;
-  Dtype* top_mask;
+  int* mask = NULL;  // suppress warnings about uninitalized variables
+  Dtype* top_mask = NULL;
   // Different pooling methods. We explicitly do the switch outside the for
   // loop to save time, although this results in more code.
   switch (this->layer_param_.pooling_param().pool()) {
@@ -195,8 +195,8 @@ void PoolingLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
   caffe_set((*bottom)[0]->count(), Dtype(0), bottom_diff);
   // We'll output the mask to top[1] if it's of size >1.
   const bool use_top_mask = top.size() > 1;
-  const int* mask;
-  const Dtype* top_mask;
+  const int* mask = NULL;  // suppress warnings about uninitialized variables
+  const Dtype* top_mask = NULL;
   switch (this->layer_param_.pooling_param().pool()) {
   case PoolingParameter_PoolMethod_MAX:
     // The main loop