Another Windows vs Linux Difference

Bytes
Image From Wikimedia Commons

Once I reached the masks section in chapter 38, I found my C code that I’d copied from Windows failed because of the type byte. MSVC is a little bit more forgiving over somethings and one of those is the byte type which it accepts.  In the Windows code, I had declared the mask arrays like this:

byte bulletmask[1][3][3];
byte plmask[24][64][64];
byte a1mask[24][280][280];
byte a2mask[24][140][140]; 
byte a3mask[24][70][70];
byte a4mask[24][35][35];

But Clang in its wisdom barfed at that, not recognising the type byte. A simple fix was replace byte with char and all was well.

Looking into it, I loaded one of the Windows asteroids projects, built it and then did a ctrl-click on the byte type. It led me to a file called rpcndr.h in a Windows SDK folder and this line (191) of code.

typedef unsigned char byte;

It just shows!  My er bad…

Leave a Reply

Your email address will not be published. Required fields are marked *