Welcome, Guest. Please login or register.

Author Topic: Optimization help needed (possible C limitation ?!)  (Read 2116 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Caius

  • Sr. Member
  • ****
  • Join Date: Nov 2007
  • Posts: 294
    • Show all replies
Re: Optimization help needed (possible C limitation ?!)
« on: November 20, 2007, 08:20:15 PM »
Specifying the 'register' storage class is only a suggestion to the compiler. The compiler may very well choose to ignore it, for example if there isn't a sufficient number of registers for the compiler to use.

Also, compilers that does good optimization may choose to put values in a register without you specifying it. Which compiler are you using? Are you compiling with optimizations?

If your compiler supports it, you could try inlining the function. Again, the compiler may choose to ignore it. Inlined functions need to be very small for the compiler to do it. The trade-off is that the function will be inserted everywhere it's being called (much like a macro), so your program will usually become larger.

If your compiler doesn't support inlining, or your concerned that it may ignore it, you could try a macro.


Theology is just a debate over who to frame for creating reality.