This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Testing m68k changes on AmigaOS and Linux/m68k


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]