Suggestions

Jonathan Coxhead jonathan at doves.demon.co.uk
Thu Apr 27 00:59:04 BST 2000


 | I suspect that people have got away with it for so long because
 | bool doesn't appear in many structs.  One rare example is with
 | drawfile_options, in the file drawfile.h.  For the file
 | 
 |   #include <stdio.h>
 |   #ifdef __GNUG__
 |     #define bool dummy
 |     #include "types.h"
 |     #undef bool
 |   #endif
 |   #include "drawfile.h"
 | 
 |   int main()
 |   {
 |     printf("%d\n", sizeof(drawfile_options));
 | 
 |     return 0;
 |   }
 | 
 | Using c++ gives 76, but using g++ gives only 60.  So, as Jonathan
 | says, we (you) have to do something.

   Now that's what I call a serious bug.

   It's equally serious in all the cases where there's a |bool| 
output parameter: e g, almost every service call, and common things 
like

      extern void osspriteop_read_sprite_size
      (
         osspriteop_flags        flags,
         osspriteop_area  const *area,
         osspriteop_id           id,
         int                    *width,
         int                    *height,
         bool                   *mask,
         os_mode                *mode
      );

which, in C++, will be passed a byte pointer, and then write a word 
to it. It doesn't get much worse than that, I'd say ...

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-user mailing list