Loose type-checking and C-style casts are gifts from the gods.
- From: Jeff☠Relf <Jeff_Relf@xxxxxxxxx>
- Date: 27 Nov 2007 16:24:05 GMT
While Uli's information about the preprocessor was fascinating,
I disagree with his latter comment,
loose type-checking and C-style casts are gifts from the gods.
For example:
#pragma warning( disable: \
4007 4101 4189 4244 4305 4430 4508 4706 4709 4996 )
#define Tics ( QueryPerformanceCounter( & _Tics ), _Tics )
#define Secs ( _Secs = Tics / Secnd_Dub )
__int64 _Tics, Secnd ; double _Secs, Secnd_Dub ;
extern "C" int __stdcall QueryPerformanceCounter( __int64 * );
extern "C" int __stdcall QueryPerformanceFrequency( __int64 * );
typedef unsigned __int32 UInt32_Type ;
typedef UInt32_Type * pUInt32_Type ;
typedef unsigned __int8 UInt8_Type ;
typedef UInt8_Type * pUInt8_Type ;
WinMain( int, int, int, int ) {
int rv = 6 ;
rv ++ ;
QueryPerformanceFrequency( & Secnd ), Secnd_Dub = Secnd ;
double Start = Secs ;
// Timing int-by-int access.
static UInt32_Type B[ 999999 ];
pUInt32_Type P = B - 1, E = B + 999999 ;
while ( ++ P < E ) * P ++ ;
float Waited_32 = Secs - Start ; Start = Secs ;
// Timing byte-by-byte access.
{ pUInt8_Type
P = pUInt8_Type( B ) - 1
, E = pUInt8_Type( B + 999999 ) ;
while ( ++ P < E ) * P ++ ;
float
Waited_8 = Secs - Start
, TimesSlower = Waited_8 / Waited_32 ;
// Breaking here,
// the debugger says: “ Waited_32 == .0029 ” seconds.
// “ Waited_8 == .0113 ” seconds.
// And “ TimesSlower == 3.96 ” times slower.
TimesSlower = TimesSlower ; } }
.
- Follow-Ups:
- References:
- Re: compile error when make a wchar_t conversion
- From: Ulrich Eckhardt
- Re: compile error when make a wchar_t conversion
- From: George
- Re: compile error when make a wchar_t conversion
- From: Ulrich Eckhardt
- Re: compile error when make a wchar_t conversion
- From: George
- Re: compile error when make a wchar_t conversion
- Prev by Date: Re: Run service in context of svchost.exe
- Next by Date: Re: Run service in context of svchost.exe
- Previous by thread: Re: compile error when make a wchar_t conversion
- Next by thread: RE: Loose type-checking and C-style casts are gifts from the gods.
- Index(es):
Relevant Pages
|