Thread: Mingw

  1. #1
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278

    Mingw

    In this compiler how can I force a function to be inline?

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Is that really the standard way? Only class methods can be inline, and I believe the only way to really force inlining is compiler dependent. The keyword inline is something that the compiler may ignore ( but it tries not to ).

    Unless you use a macro or something. But don't do that.

  3. #3
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    278
    But we can declare non-class member function inline too! Yes it is true i is compiler dependent but can't we force inline in mingw as we use __forceinline in VC++?

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Mingw does not define __forceinline. In general that's a bad idea to force inline functions, anyway, so you're probably better off finding another way to deal with your performance problem. Try using inline first; see if that does anything to help. And prove it's just as slow before you come back.
    Last edited by whiteflags; 04-17-2007 at 02:07 AM.

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    The problem witth function inlining is yes it can speed up the excution time, but this does come at the expense of a larger program size. The thing that can be hard to balance is program performance and program speed. Inlining a function is usually only done after you have the program working. If, you can see any bottlenecks in the code, then perhaps inlining a function to get a more effective result could be implemented. ( that is down to the compiler as citizen stated )
    Double Helix STL

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mingw and elcipse HELP
    By Rob4226 in forum Windows Programming
    Replies: 1
    Last Post: 03-04-2008, 01:35 AM
  2. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  3. Free compiler for commercial development? (mingw?)
    By kook44 in forum Windows Programming
    Replies: 8
    Last Post: 01-07-2006, 09:32 AM
  4. SDL and MinGW Studio
    By Vicious in forum Tech Board
    Replies: 0
    Last Post: 07-30-2004, 09:59 PM
  5. Convert Microsoft LIB to MingW compatible lib
    By tigs in forum Windows Programming
    Replies: 0
    Last Post: 07-20-2004, 06:53 PM