THRIFT-4762: Applied some C++11 refactorings to the runtime library and compiler (#1719)

* make use of C++11 override keyword
* added const specifier to TTransport::getOrigin()
* added more const correctness to the compiler
* make use of auto keyword
* replaced usage of NULL with nullptr
* make use of explicitly-defaulted function definition
* extended changelog
diff --git a/test/cpp/src/StressTest.cpp b/test/cpp/src/StressTest.cpp
index 930261e..1683125 100644
--- a/test/cpp/src/StressTest.cpp
+++ b/test/cpp/src/StressTest.cpp
@@ -64,7 +64,7 @@
 
 class Server : public ServiceIf {
 public:
-  Server() {}
+  Server() = default;
 
   void count(const char* method) {
     Guard m(lock_);
@@ -72,7 +72,7 @@
     counts_[method] = ++ct;
   }
 
-  void echoVoid() {
+  void echoVoid() override {
     count("echoVoid");
     return;
   }
@@ -82,18 +82,18 @@
     return counts_;
   }
 
-  int8_t echoByte(const int8_t arg) { return arg; }
-  int32_t echoI32(const int32_t arg) { return arg; }
-  int64_t echoI64(const int64_t arg) { return arg; }
-  void echoString(string& out, const string& arg) {
+  int8_t echoByte(const int8_t arg) override { return arg; }
+  int32_t echoI32(const int32_t arg) override { return arg; }
+  int64_t echoI64(const int64_t arg) override { return arg; }
+  void echoString(string& out, const string& arg) override {
     if (arg != "hello") {
       T_ERROR_ABORT("WRONG STRING (%s)!!!!", arg.c_str());
     }
     out = arg;
   }
-  void echoList(vector<int8_t>& out, const vector<int8_t>& arg) { out = arg; }
-  void echoSet(set<int8_t>& out, const set<int8_t>& arg) { out = arg; }
-  void echoMap(map<int8_t, int8_t>& out, const map<int8_t, int8_t>& arg) { out = arg; }
+  void echoList(vector<int8_t>& out, const vector<int8_t>& arg) override { out = arg; }
+  void echoSet(set<int8_t>& out, const set<int8_t>& arg) override { out = arg; }
+  void echoMap(map<int8_t, int8_t>& out, const map<int8_t, int8_t>& arg) override { out = arg; }
 
 private:
   count_map counts_;
@@ -121,7 +121,7 @@
       _loopType(loopType),
       _behavior(behavior) {}
 
-  void run() {
+  void run() override {
 
     // Wait for all worker threads to start
 
@@ -239,7 +239,7 @@
 class TStartObserver : public apache::thrift::server::TServerEventHandler {
 public:
   TStartObserver() : awake_(false) {}
-  virtual void preServe() {
+  void preServe() override {
     apache::thrift::concurrency::Synchronized s(m_);
     awake_ = true;
     m_.notifyAll();
@@ -524,7 +524,7 @@
       }
     }
 
-    for (std::set<std::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
+    for (auto thread = clientThreads.begin();
          thread != clientThreads.end();
          thread++) {
       (*thread)->start();
@@ -557,7 +557,7 @@
     int64_t minTime = 9223372036854775807LL;
     int64_t maxTime = 0;
 
-    for (set<std::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
+    for (auto ix = clientThreads.begin();
          ix != clientThreads.end();
          ix++) {
 
diff --git a/test/cpp/src/StressTestNonBlocking.cpp b/test/cpp/src/StressTestNonBlocking.cpp
index ead2df5..e94ecb2 100644
--- a/test/cpp/src/StressTestNonBlocking.cpp
+++ b/test/cpp/src/StressTestNonBlocking.cpp
@@ -67,7 +67,7 @@
 
 class Server : public ServiceIf {
 public:
-  Server() {}
+  Server() = default;
 
   void count(const char* method) {
     Guard m(lock_);
@@ -75,7 +75,7 @@
     counts_[method] = ++ct;
   }
 
-  void echoVoid() {
+  void echoVoid() override {
     count("echoVoid");
     // Sleep to simulate work
     THRIFT_SLEEP_USEC(1);
@@ -87,18 +87,18 @@
     return counts_;
   }
 
-  int8_t echoByte(const int8_t arg) { return arg; }
-  int32_t echoI32(const int32_t arg) { return arg; }
-  int64_t echoI64(const int64_t arg) { return arg; }
-  void echoString(string& out, const string& arg) {
+  int8_t echoByte(const int8_t arg) override { return arg; }
+  int32_t echoI32(const int32_t arg) override { return arg; }
+  int64_t echoI64(const int64_t arg) override { return arg; }
+  void echoString(string& out, const string& arg) override {
     if (arg != "hello") {
       T_ERROR_ABORT("WRONG STRING (%s)!!!!", arg.c_str());
     }
     out = arg;
   }
-  void echoList(vector<int8_t>& out, const vector<int8_t>& arg) { out = arg; }
-  void echoSet(set<int8_t>& out, const set<int8_t>& arg) { out = arg; }
-  void echoMap(map<int8_t, int8_t>& out, const map<int8_t, int8_t>& arg) { out = arg; }
+  void echoList(vector<int8_t>& out, const vector<int8_t>& arg) override { out = arg; }
+  void echoSet(set<int8_t>& out, const set<int8_t>& arg) override { out = arg; }
+  void echoMap(map<int8_t, int8_t>& out, const map<int8_t, int8_t>& arg) override { out = arg; }
 
 private:
   count_map counts_;
@@ -120,7 +120,7 @@
       _loopCount(loopCount),
       _loopType(loopType) {}
 
-  void run() {
+  void run() override {
 
     // Wait for all worker threads to start
 
@@ -462,7 +462,7 @@
           new ClientThread(socket, serviceClient, monitor, threadCount, loopCount, loopType))));
     }
 
-    for (std::set<std::shared_ptr<Thread> >::const_iterator thread = clientThreads.begin();
+    for (auto thread = clientThreads.begin();
          thread != clientThreads.end();
          thread++) {
       (*thread)->start();
@@ -495,7 +495,7 @@
     int64_t minTime = 9223372036854775807LL;
     int64_t maxTime = 0;
 
-    for (set<std::shared_ptr<Thread> >::iterator ix = clientThreads.begin();
+    for (auto ix = clientThreads.begin();
          ix != clientThreads.end();
          ix++) {
 
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 89f3fd1..2a06578 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -65,7 +65,7 @@
   int64_t ret;
   struct timeval tv;
 
-  THRIFT_GETTIMEOFDAY(&tv, NULL);
+  THRIFT_GETTIMEOFDAY(&tv, nullptr);
   ret = tv.tv_sec;
   ret = ret * 1000 * 1000 + tv.tv_usec;
   return ret;
@@ -942,11 +942,11 @@
       if (it1 == whoa.end()) {
         failed = true;
       } else {
-        map<Numberz::type, Insanity>::const_iterator it12 = it1->second.find(Numberz::TWO);
+        auto it12 = it1->second.find(Numberz::TWO);
         if (it12 == it1->second.end() || it12->second != insane) {
           failed = true;
         }
-        map<Numberz::type, Insanity>::const_iterator it13 = it1->second.find(Numberz::THREE);
+        auto it13 = it1->second.find(Numberz::THREE);
         if (it13 == it1->second.end() || it13->second != insane) {
           failed = true;
         }
@@ -955,7 +955,7 @@
       if (it2 == whoa.end()) {
         failed = true;
       } else {
-        map<Numberz::type, Insanity>::const_iterator it26 = it2->second.find(Numberz::SIX);
+        auto it26 = it2->second.find(Numberz::SIX);
         if (it26 == it2->second.end() || it26->second != Insanity()) {
           failed = true;
         }
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 4106628..8d5b4d9 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -90,48 +90,48 @@
 
 class TestHandler : public ThriftTestIf {
 public:
-  TestHandler() {}
+  TestHandler() = default;
 
-  void testVoid() { printf("testVoid()\n"); }
+  void testVoid() override { printf("testVoid()\n"); }
 
-  void testString(string& out, const string& thing) {
+  void testString(string& out, const string& thing) override {
     printf("testString(\"%s\")\n", thing.c_str());
     out = thing;
   }
 
-  bool testBool(const bool thing) {
+  bool testBool(const bool thing) override {
     printf("testBool(%s)\n", thing ? "true" : "false");
     return thing;
   }
 
-  int8_t testByte(const int8_t thing) {
+  int8_t testByte(const int8_t thing) override {
     printf("testByte(%d)\n", (int)thing);
     return thing;
   }
 
-  int32_t testI32(const int32_t thing) {
+  int32_t testI32(const int32_t thing) override {
     printf("testI32(%d)\n", thing);
     return thing;
   }
 
-  int64_t testI64(const int64_t thing) {
+  int64_t testI64(const int64_t thing) override {
     printf("testI64(%" PRId64 ")\n", thing);
     return thing;
   }
 
-  double testDouble(const double thing) {
+  double testDouble(const double thing) override {
     printf("testDouble(%f)\n", thing);
     return thing;
   }
 
-  void testBinary(std::string& _return, const std::string& thing) {
+  void testBinary(std::string& _return, const std::string& thing) override {
     std::ostringstream hexstr;
     hexstr << std::hex << thing;
     printf("testBinary(%lu: %s)\n", safe_numeric_cast<unsigned long>(thing.size()), hexstr.str().c_str());
     _return = thing;
   }
 
-  void testStruct(Xtruct& out, const Xtruct& thing) {
+  void testStruct(Xtruct& out, const Xtruct& thing) override {
     printf("testStruct({\"%s\", %d, %d, %" PRId64 "})\n",
            thing.string_thing.c_str(),
            (int)thing.byte_thing,
@@ -140,7 +140,7 @@
     out = thing;
   }
 
-  void testNest(Xtruct2& out, const Xtruct2& nest) {
+  void testNest(Xtruct2& out, const Xtruct2& nest) override {
     const Xtruct& thing = nest.struct_thing;
     printf("testNest({%d, {\"%s\", %d, %d, %" PRId64 "}, %d})\n",
            (int)nest.byte_thing,
@@ -152,7 +152,7 @@
     out = nest;
   }
 
-  void testMap(map<int32_t, int32_t>& out, const map<int32_t, int32_t>& thing) {
+  void testMap(map<int32_t, int32_t>& out, const map<int32_t, int32_t>& thing) override {
     printf("testMap({");
     map<int32_t, int32_t>::const_iterator m_iter;
     bool first = true;
@@ -169,7 +169,7 @@
   }
 
   void testStringMap(map<std::string, std::string>& out,
-                     const map<std::string, std::string>& thing) {
+                     const map<std::string, std::string>& thing) override {
     printf("testMap({");
     map<std::string, std::string>::const_iterator m_iter;
     bool first = true;
@@ -185,7 +185,7 @@
     out = thing;
   }
 
-  void testSet(set<int32_t>& out, const set<int32_t>& thing) {
+  void testSet(set<int32_t>& out, const set<int32_t>& thing) override {
     printf("testSet({");
     set<int32_t>::const_iterator s_iter;
     bool first = true;
@@ -201,7 +201,7 @@
     out = thing;
   }
 
-  void testList(vector<int32_t>& out, const vector<int32_t>& thing) {
+  void testList(vector<int32_t>& out, const vector<int32_t>& thing) override {
     printf("testList({");
     vector<int32_t>::const_iterator l_iter;
     bool first = true;
@@ -217,17 +217,17 @@
     out = thing;
   }
 
-  Numberz::type testEnum(const Numberz::type thing) {
+  Numberz::type testEnum(const Numberz::type thing) override {
     printf("testEnum(%d)\n", thing);
     return thing;
   }
 
-  UserId testTypedef(const UserId thing) {
+  UserId testTypedef(const UserId thing) override {
     printf("testTypedef(%" PRId64 ")\n", thing);
     return thing;
   }
 
-  void testMapMap(map<int32_t, map<int32_t, int32_t> >& mapmap, const int32_t hello) {
+  void testMapMap(map<int32_t, map<int32_t, int32_t> >& mapmap, const int32_t hello) override {
     printf("testMapMap(%d)\n", hello);
 
     map<int32_t, int32_t> pos;
@@ -241,7 +241,7 @@
     mapmap.insert(make_pair(-4, neg));
   }
 
-  void testInsanity(map<UserId, map<Numberz::type, Insanity> >& insane, const Insanity& argument) {
+  void testInsanity(map<UserId, map<Numberz::type, Insanity> >& insane, const Insanity& argument) override {
     printf("testInsanity()\n");
 
     Insanity looney;
@@ -297,7 +297,7 @@
                  const int64_t arg2,
                  const std::map<int16_t, std::string>& arg3,
                  const Numberz::type arg4,
-                 const UserId arg5) {
+                 const UserId arg5) override {
     (void)arg3;
     (void)arg4;
     (void)arg5;
@@ -310,7 +310,7 @@
     hello.i64_thing = (int64_t)arg2;
   }
 
-  void testException(const std::string& arg) {
+  void testException(const std::string& arg) override {
     printf("testException(%s)\n", arg.c_str());
     if (arg.compare("Xception") == 0) {
       Xception e;
@@ -329,7 +329,7 @@
 
   void testMultiException(Xtruct& result,
                           const std::string& arg0,
-                          const std::string& arg1) {
+                          const std::string& arg1) override {
 
     printf("testMultiException(%s, %s)\n", arg0.c_str(), arg1.c_str());
 
@@ -349,7 +349,7 @@
     }
   }
 
-  void testOneway(const int32_t aNum) {
+  void testOneway(const int32_t aNum) override {
     printf("testOneway(%d): call received\n", aNum);
   }
 };
@@ -357,33 +357,33 @@
 class SecondHandler : public SecondServiceIf
 {
   public:
-    void secondtestString(std::string& result, const std::string& thing)
+    void secondtestString(std::string& result, const std::string& thing) override
     { result = "testString(\"" + thing + "\")"; }
 };
 
 class TestProcessorEventHandler : public TProcessorEventHandler {
-  virtual void* getContext(const char* fn_name, void* serverContext) {
+  void* getContext(const char* fn_name, void* serverContext) override {
     (void)serverContext;
     return new std::string(fn_name);
   }
-  virtual void freeContext(void* ctx, const char* fn_name) {
+  void freeContext(void* ctx, const char* fn_name) override {
     (void)fn_name;
     delete static_cast<std::string*>(ctx);
   }
-  virtual void preRead(void* ctx, const char* fn_name) { communicate("preRead", ctx, fn_name); }
-  virtual void postRead(void* ctx, const char* fn_name, uint32_t bytes) {
+  void preRead(void* ctx, const char* fn_name) override { communicate("preRead", ctx, fn_name); }
+  void postRead(void* ctx, const char* fn_name, uint32_t bytes) override {
     (void)bytes;
     communicate("postRead", ctx, fn_name);
   }
-  virtual void preWrite(void* ctx, const char* fn_name) { communicate("preWrite", ctx, fn_name); }
-  virtual void postWrite(void* ctx, const char* fn_name, uint32_t bytes) {
+  void preWrite(void* ctx, const char* fn_name) override { communicate("preWrite", ctx, fn_name); }
+  void postWrite(void* ctx, const char* fn_name, uint32_t bytes) override {
     (void)bytes;
     communicate("postWrite", ctx, fn_name);
   }
-  virtual void asyncComplete(void* ctx, const char* fn_name) {
+  void asyncComplete(void* ctx, const char* fn_name) override {
     communicate("asyncComplete", ctx, fn_name);
   }
-  virtual void handlerError(void* ctx, const char* fn_name) {
+  void handlerError(void* ctx, const char* fn_name) override {
     communicate("handlerError", ctx, fn_name);
   }
 
@@ -395,136 +395,136 @@
 class TestHandlerAsync : public ThriftTestCobSvIf {
 public:
   TestHandlerAsync(std::shared_ptr<TestHandler>& handler) : _delegate(handler) {}
-  virtual ~TestHandlerAsync() {}
+  ~TestHandlerAsync() override = default;
 
-  virtual void testVoid(std::function<void()> cob) {
+  void testVoid(std::function<void()> cob) override {
     _delegate->testVoid();
     cob();
   }
 
-  virtual void testString(std::function<void(std::string const& _return)> cob,
-                          const std::string& thing) {
+  void testString(std::function<void(std::string const& _return)> cob,
+                          const std::string& thing) override {
     std::string res;
     _delegate->testString(res, thing);
     cob(res);
   }
 
-  virtual void testBool(std::function<void(bool const& _return)> cob, const bool thing) {
+  void testBool(std::function<void(bool const& _return)> cob, const bool thing) override {
     bool res = _delegate->testBool(thing);
     cob(res);
   }
 
-  virtual void testByte(std::function<void(int8_t const& _return)> cob, const int8_t thing) {
+  void testByte(std::function<void(int8_t const& _return)> cob, const int8_t thing) override {
     int8_t res = _delegate->testByte(thing);
     cob(res);
   }
 
-  virtual void testI32(std::function<void(int32_t const& _return)> cob, const int32_t thing) {
+  void testI32(std::function<void(int32_t const& _return)> cob, const int32_t thing) override {
     int32_t res = _delegate->testI32(thing);
     cob(res);
   }
 
-  virtual void testI64(std::function<void(int64_t const& _return)> cob, const int64_t thing) {
+  void testI64(std::function<void(int64_t const& _return)> cob, const int64_t thing) override {
     int64_t res = _delegate->testI64(thing);
     cob(res);
   }
 
-  virtual void testDouble(std::function<void(double const& _return)> cob, const double thing) {
+  void testDouble(std::function<void(double const& _return)> cob, const double thing) override {
     double res = _delegate->testDouble(thing);
     cob(res);
   }
 
-  virtual void testBinary(std::function<void(std::string const& _return)> cob,
-                          const std::string& thing) {
+  void testBinary(std::function<void(std::string const& _return)> cob,
+                          const std::string& thing) override {
     std::string res;
     _delegate->testBinary(res, thing);
     cob(res);
   }
 
-  virtual void testStruct(std::function<void(Xtruct const& _return)> cob, const Xtruct& thing) {
+  void testStruct(std::function<void(Xtruct const& _return)> cob, const Xtruct& thing) override {
     Xtruct res;
     _delegate->testStruct(res, thing);
     cob(res);
   }
 
-  virtual void testNest(std::function<void(Xtruct2 const& _return)> cob, const Xtruct2& thing) {
+  void testNest(std::function<void(Xtruct2 const& _return)> cob, const Xtruct2& thing) override {
     Xtruct2 res;
     _delegate->testNest(res, thing);
     cob(res);
   }
 
-  virtual void testMap(std::function<void(std::map<int32_t, int32_t> const& _return)> cob,
-                       const std::map<int32_t, int32_t>& thing) {
+  void testMap(std::function<void(std::map<int32_t, int32_t> const& _return)> cob,
+                       const std::map<int32_t, int32_t>& thing) override {
     std::map<int32_t, int32_t> res;
     _delegate->testMap(res, thing);
     cob(res);
   }
 
-  virtual void testStringMap(
+  void testStringMap(
       std::function<void(std::map<std::string, std::string> const& _return)> cob,
-      const std::map<std::string, std::string>& thing) {
+      const std::map<std::string, std::string>& thing) override {
     std::map<std::string, std::string> res;
     _delegate->testStringMap(res, thing);
     cob(res);
   }
 
-  virtual void testSet(std::function<void(std::set<int32_t> const& _return)> cob,
-                       const std::set<int32_t>& thing) {
+  void testSet(std::function<void(std::set<int32_t> const& _return)> cob,
+                       const std::set<int32_t>& thing) override {
     std::set<int32_t> res;
     _delegate->testSet(res, thing);
     cob(res);
   }
 
-  virtual void testList(std::function<void(std::vector<int32_t> const& _return)> cob,
-                        const std::vector<int32_t>& thing) {
+  void testList(std::function<void(std::vector<int32_t> const& _return)> cob,
+                        const std::vector<int32_t>& thing) override {
     std::vector<int32_t> res;
     _delegate->testList(res, thing);
     cob(res);
   }
 
-  virtual void testEnum(std::function<void(Numberz::type const& _return)> cob,
-                        const Numberz::type thing) {
+  void testEnum(std::function<void(Numberz::type const& _return)> cob,
+                        const Numberz::type thing) override {
     Numberz::type res = _delegate->testEnum(thing);
     cob(res);
   }
 
-  virtual void testTypedef(std::function<void(UserId const& _return)> cob, const UserId thing) {
+  void testTypedef(std::function<void(UserId const& _return)> cob, const UserId thing) override {
     UserId res = _delegate->testTypedef(thing);
     cob(res);
   }
 
-  virtual void testMapMap(
+  void testMapMap(
       std::function<void(std::map<int32_t, std::map<int32_t, int32_t> > const& _return)> cob,
-      const int32_t hello) {
+      const int32_t hello) override {
     std::map<int32_t, std::map<int32_t, int32_t> > res;
     _delegate->testMapMap(res, hello);
     cob(res);
   }
 
-  virtual void testInsanity(
+  void testInsanity(
       std::function<void(std::map<UserId, std::map<Numberz::type, Insanity> > const& _return)> cob,
-      const Insanity& argument) {
+      const Insanity& argument) override {
     std::map<UserId, std::map<Numberz::type, Insanity> > res;
     _delegate->testInsanity(res, argument);
     cob(res);
   }
 
-  virtual void testMulti(std::function<void(Xtruct const& _return)> cob,
+  void testMulti(std::function<void(Xtruct const& _return)> cob,
                          const int8_t arg0,
                          const int32_t arg1,
                          const int64_t arg2,
                          const std::map<int16_t, std::string>& arg3,
                          const Numberz::type arg4,
-                         const UserId arg5) {
+                         const UserId arg5) override {
     Xtruct res;
     _delegate->testMulti(res, arg0, arg1, arg2, arg3, arg4, arg5);
     cob(res);
   }
 
-  virtual void testException(
+  void testException(
       std::function<void()> cob,
       std::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
-      const std::string& arg) {
+      const std::string& arg) override {
     try {
       _delegate->testException(arg);
     } catch (const apache::thrift::TException& e) {
@@ -534,11 +534,11 @@
     cob();
   }
 
-  virtual void testMultiException(
+  void testMultiException(
       std::function<void(Xtruct const& _return)> cob,
       std::function<void(::apache::thrift::TDelayedException* _throw)> exn_cob,
       const std::string& arg0,
-      const std::string& arg1) {
+      const std::string& arg1) override {
     Xtruct res;
     try {
       _delegate->testMultiException(res, arg0, arg1);
@@ -549,7 +549,7 @@
     cob(res);
   }
 
-  virtual void testOneway(std::function<void()> cob, const int32_t secondsToSleep) {
+  void testOneway(std::function<void()> cob, const int32_t secondsToSleep) override {
     _delegate->testOneway(secondsToSleep);
     cob();
   }
@@ -672,7 +672,7 @@
     std::shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
     protocolFactory = jsonProtocolFactory;
   } else if (protocol_type == "compact" || protocol_type == "multic") {
-    TCompactProtocolFactoryT<TBufferBase> *compactProtocolFactory = new TCompactProtocolFactoryT<TBufferBase>();
+    auto *compactProtocolFactory = new TCompactProtocolFactoryT<TBufferBase>();
     compactProtocolFactory->setContainerSizeLimit(container_limit);
     compactProtocolFactory->setStringSizeLimit(string_limit);
     protocolFactory.reset(compactProtocolFactory);
@@ -680,7 +680,7 @@
     std::shared_ptr<TProtocolFactory> headerProtocolFactory(new THeaderProtocolFactory());
     protocolFactory = headerProtocolFactory;
   } else {
-    TBinaryProtocolFactoryT<TBufferBase>* binaryProtocolFactory = new TBinaryProtocolFactoryT<TBufferBase>();
+    auto* binaryProtocolFactory = new TBinaryProtocolFactoryT<TBufferBase>();
     binaryProtocolFactory->setContainerSizeLimit(container_limit);
     binaryProtocolFactory->setStringSizeLimit(string_limit);
     protocolFactory.reset(binaryProtocolFactory);
@@ -810,7 +810,7 @@
     }
   }
 
-  if (server.get() != NULL) {
+  if (server.get() != nullptr) {
     if (protocol_type == "header") {
       // Tell the server to use the same protocol for input / output
       // if using header