   using __fastcall & inline at the same time
  I''m using VS .NETwhat about the using both __inline and __fastcall at the same time, is it good?i did it for a function whose implementation is written in assembly, and it did nothing but slow it down, when i removed inline only, the function went about 5 times faster.how can this happen, how can inlining slow down a function?   xee.. 
  Since an inlined function isn''t actually passed any parameters (hence inline) I think __fastcall might just confuse the compiler, if do anything at all. ;  Yes, nothing can be both __fastcall and inline at the same time. Code declared inline is (usually) inserted into where-ever it is called, almost as if it had been pasted in there (well not quite, but you get the point).Specifying a calling convention, such as __fastcall in direct contradiction to inline. __fastcall is a way of telling the compiler how the parameters are to be passed to the function. But if it is inline, it is not actually a function you can call. Hence the confusion. For more information about calling conventions, see <a href="http://weblogs.asp.net/oldnewthing/archive/2004/01/02/47184.aspx">this</a> ;  @Poster,Xee said i did it  . So unless he lies or does not know what he does I think your assertion that nothing can be both __fastcall and inline at the same time  . K then I understand that you may mean in practice the compiler igonres one of the directives. __fastcall and inline  Please refer to the MS Visual documentation. There nothing that prevents it and it's quite logical. For inlined functions that contain strict C/C++ code the effects of __fastcall will simply disappear in the optimization stages. But for inlined functions containing inline asm, it's another story.@XeeHow can this happen, how can inlining slow down a function?  This may be because of register pressure. You try to tweak the compiler 3 times : once with inline (paste code here in the middle of intructions already using registers), once with fastcall (force into registers) and then with inline asm force again into registers. An Intel compatible has only 6 registers available. So sometimes using functions and call stack is better than forcing into register. Then the register cache (6*32bits) becomes the 'bottleneck'.K Xee pls post your C code sample and the resulting asm in both cases (with or without inline keyword). Else fastcall and asm are very risky to handle. I'll explain you while and how to solve it. There is an hand made solution with __declspec. I use .6 but I don't think much has changed in .Net. I am nearly sure you'll see such stupid code in the .asm, except the wise comments :mov eax, [esp+?] ; register memory overflowedmov [esp+?], ebx ; ...mov ebx, eax; <= the fastcall stuff.mov esi, ebx; <= your inline asm.; ... and the unecessary instruction list goes on.The following sequence is due to a sequence of constraints thatstarts with an instruction style __asm mov esi, param1.  In depth the problem is Visual does not recombine hand written asm instructions with C generated asm. So on the boundaries of the inlined asm function there will be a lot of sh*t because the optimizer (code scheduler) is not meant to handle this situation.    [edited by - Charles B on February 7, 2004 7:13:25 AM];  BTW I dream of an inline asm language that would be perfectly optimized ot be merged with C code. Only one more asm directive would be required. Example :inline void Acc( register int *pOut, register int *pInp ){__asm reg p0, pOut__asm reg p1, pInp __asm reg r0  ; any available register__asm reg r1, eax, ebx ;  (r1 can be eax or ebx)__asm mov r0, [p0]__asm mov r1, [p1]__asm add r0, r1// etc ...}The compiler would have enough info to avoid stupid register swaps at the C/inline asm borders. It could also be cool to #pragma a directive where __asm code reordering is allowed. ;  Charles B : gcc does what you want...It''s mandatory for efficient ps2 asm code...;  Yep, gcc is great. But I also have to code my math lib for Visual. 