Mingw

This is a discussion on Mingw within the C++ Programming forums, part of the General Programming Boards category; In this compiler how can I force a function to be inline?...

  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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,627
    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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,627
    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,475
    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 )
    I'm just trying to be a better person - My Name Is Earl

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, 12: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, 08: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21