Simple tutorials for complex subjects

rikki cattermole rikki at cattermole.co.nz
Sun Jun 3 16:31:45 UTC 2018


On 04/06/2018 4:25 AM, Ethan wrote:
> Step seven: In your receive function that takes a byte stream, put in a 
> switch statement that looks a little bit like the following:
> 
> switch( msg.GetID )
> {
>      static foreach( Message; ServerMessages )
>      {
>      case ObjectIDOf!Message:
>          Message deserialised = msg.FromBinary!Message;
>          this.receive( deserialised );
>      }
>      default:
>          break;
> }

Make that a final switch, that should generate better assembly.


More information about the Digitalmars-d mailing list