Re: [AD] Proposed ASSERT protection

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hello.

September 10, 2002, 1:43:26 AM, Grzegorz Adam Hankiewicz wrote:
> Sure, I will do more in a few days.
September 13, 2002, 1:33:23 AM, Grzegorz Adam Hankiewicz wrote:
>I did, and now I will concentrate on other things.


I agree, that ASSERT protection is cool, but it seem to protect me
perfectly from using any non-GCC compiler (Allegro 4.1.2):


void quad3d(BITMAP *bmp, int type, BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4)
{
   ASSERT(bmp);
   #if (defined ALLEGRO_GCC) && (defined ALLEGRO_I386)

      /* dodgy assumption alert! See comments for triangle() */
      polygon3d(bmp, type, texture, 4, &v1);

   #else

      V3D *vertex[4];

      vertex[0] = v1;
      vertex[1] = v2;
      vertex[2] = v3;
      vertex[3] = v4;
      polygon3d(bmp, type, texture, 4, vertex);

   #endif
}


Grzegorz, how about moving the ASSERT(bmp) into each #if branch and
place it after declarations, like this:


/* quad3d:
 *  Draws a 3d quad.
 */
void quad3d(BITMAP *bmp, int type, BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4)
{
   #if (defined ALLEGRO_GCC) && (defined ALLEGRO_I386)

      ASSERT(bmp);

      /* dodgy assumption alert! See comments for triangle() */
      polygon3d(bmp, type, texture, 4, &v1);

   #else

      V3D *vertex[4];

      ASSERT(bmp);

      vertex[0] = v1;
      vertex[1] = v2;
      vertex[2] = v3;
      vertex[3] = v4;
      polygon3d(bmp, type, texture, 4, vertex);

   #endif
}


Same thing for quad3d_f.

--
Kirill Kryukov



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/