| << Topic |
< Post |
Post 1 of 1 Topic 3668 of 3852
|
Post > |
Topic >> |
Strange bug with QueryPerformanceCounter, Int64, Nodes and Aliases ?!?!?
by "Skybuck Flying" <spam@[EMAIL PROTECTED]
>
Mar 29, 2008 at 01:02 PM
|
Hello,
The following code uses nodes, it uses aliases to prevent having to
typecast
stuff.
Then it calls QueryPerformanceCounter( SomeNodeRecord.Int64Field ).
And then for some reason it doesn't work, Int64Field is always zero ?
Take a look at this and tell me what you think:
// *** Begin of Code ***
program Project1;
{$APPTYPE CONSOLE}
{
Test strange compiler bug with nodes and aliases.
Version 0.01 created on 29 march 2008 by Skybuck Flying !!!
Compiler bugs starting to piss me off ! :)
Keep cool ! =D :):):)
At the same time funny though :)
This serious bug though ?!?
}
uses
SysUtils, Windows;
type
Pnode = ^Tnode;
Tnode = packed record
mNext : Pnode;
mPrev : Pnode;
mData : packed record end;
end;
TMyMethod = procedure of object;
PMyNode = ^TmyNode;
TMyNode = packed record
mNext : PmyNode;
mPrev : PmyNode;
mMethod : TmyMethod;
mDone : boolean;
mTicks : int64;
end;
var
Test : TMyNode;
function Return( var Node : Pnode ) : boolean;
begin
Node := @[EMAIL PROTECTED]
result := true;
end;
procedure TestInt64( var I : int64 );
begin
I := 666;
end;
procedure Main;
var
MyNodeTyped : PmyNode;
MyNodeUntyped : Pnode absolute MyNodeTyped;
vTest : int64;
begin
if Return( MyNodeUntyped ) then
begin
with MyNodeTyped^ do
begin
mDone := false;
mMethod := nil;
QueryPerformanceCounter( mTicks ); // DOES NOT WORK. STRANGE !!!
writeln( mTicks ); // ALWAYS PRINTS ZERO.
TestInt64( mTicks ); // DOES WORK. Bug seems to be related to
QueryPerformanceCounter in combination with alias ?
writeln( mTicks );
QueryPerformanceCounter( vTest ); // does work..
writeln( vTest );
end;
end;
end;
begin
try
Main;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
readln;
end.
// *** End of Code ***
Bye,
Skybuck.


|
1 Posts in Topic:
|
"Skybuck Flying" |
2008-03-29 13:02:54 |
|
Post A Reply:

|