Testing m68k changes on AmigaOS and Linux/m68k

Bernardo Innocenti bernie@develer.com
Thu Oct 23 20:30:00 GMT 2003


Gunther Nikl wrote:

>>I used it in several projects using BOOPSI classes. As you can see,
>>I had two sets of macros because GCC did not want to inline the
>>varargs functions.
> 
>   The approach with the array is nasty :-/ Every usage of such macro
>   will create a distinc array and this will eat up stackspace. Thats
>   why I always disabled these macros.

I don't quite understand.  There's (almost) no difference in stack
space usage between this:

  {
     int v[] = { 1, 2, 3, 4, 5 };
     extern foo(int *);
     foo(v);
  }

...and this:

  {
     extern foo(...);
     foo(1, 2, 3, 4, 5);
  }


With the varargs form, the compiler will push all arguments
on the stack before calling foo(), effectively wasting the
same amount of stack space of the local array.

When I had to pass a taglist made entirely of constant
values, I used to do this instead:

   {
      static const int tags[] =
      {
          XA_Foo, 1,
          XA_Bar, 2,
          XA_Baz, 3,
          TAG_DONE
      }

      SetAttrsA(o, tags);
   }

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html





More information about the Gcc mailing list