Archived

This topic is now archived and is closed to further replies.

Yoshy

AHH - What have I done ?

Recommended Posts

Okay, I just want to confirm this bug in VC++6, I have a function ( FastCos ) that is defined like this:
      
__forceinline float __stdcall FastCos(float a) {
		__asm {
				fld		DWORD PTR [esp+4] 
				fcos
				ret 4
		}
}
  
Okay, so when I do 
      
 float a = FastCos(10);
      
the compiler doesn't even compile this it complains about an 'fatal error C1001: INTERNAL COMPILER ERROR' -- (The exact error is included below). BTW - This code compiles & run under Win32 Debug ! I just want to know if you guys are experiencing the same problem with this code or/and if you have suggestions...
(Heres the full error...)
--------------------Configuration: glTek - Win32 Release XP--------------------
Compiling...
Tek.cpp
C:\Documents and Settings\Philippe\Desktop\Development\OpenGL\glTek\Tek.cpp(142) : fatal error C1001: INTERNAL COMPILER ERROR
  (compiler file 'E:\8966\vc98\p2\src\P2\main.c', line 494)
    Please choose the Technical Support command on the Visual C++
    Help menu, or open the Technical Support help file for more information
Error executing cl.exe.

glTek.exe - 1 error(s), 0 warning(s)
   
_____________________ Yoshy - From The Bobs Edited by - Yoshy on December 14, 2001 10:15:24 PM

Share this post


Link to post
Share on other sites
quote:
Original post by terminate
Perhaps you have a corrupted file within VC++, try reinstalling.




Done that -- Do you have Service Pack 5 installed ?, I installed it ( and the platform sdk )...

Share this post


Link to post
Share on other sites
You''ll have some troubles with this function in MSVC.NET.. I used the same function but had to throw it out.. It compile fine but it gives some wierd error when you run it..

There are more worlds than the one that you hold in your hand...

Share this post


Link to post
Share on other sites
A correct inline cos function would look like this.
  
#pragma warning(disable : 4035)

inline float FastCos(float a)
{
__asm
{
fld a
fcos
}
}

#pragma warning(default : 4035)


float a = FastCos(10);

Compiles out nicely to...

00401002 mov dword ptr [esp],41200000h
0040100A fld dword ptr [esp]
0040100E fcos

MSVC will know that the return float is in st(0)

You can use the pragma statement to remove "warning C4035: ''FastCos'' : no return value"

Share this post


Link to post
Share on other sites