Adding Java and C++ to the MQTT benchmarks or: How I Learned to Stop Worrying and Love the Garbage Collector

bearophile bearophileHUGS at lycos.com
Wed Jan 8 04:35:00 PST 2014


Atila Neves:

> http://atilanevesoncode.wordpress.com/2014/01/08/adding-java-and-c-to-the-mqtt-benchmarks-or-how-i-learned-to-stop-worrying-and-love-the-garbage-collector/

In this file:
https://github.com/atilaneves/mqtt/blob/master/mqttd/factory.d

Instead of code:

         switch(fixedHeader.type) {
         case MqttType.CONNECT:
             return cereal.value!MqttConnect(fixedHeader);
         case MqttType.CONNACK:


Perhaps you want code as:

         final switch(fixedHeader.type) with (MqttType) {
         case CONNECT:
             return cereal.value!MqttConnect(fixedHeader);
         case CONNACK:
         ...


Or even (modifying the enum):

         final switch(fixedHeader.type) with (MqttType) {
         case connect:
             return cereal.value!MqttConnect(fixedHeader);
         case connack:
         ...


Bye,
bearophile


More information about the Digitalmars-d mailing list