-
Content Count
560 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Vandrovnik
-
Strange behavior for literals
Vandrovnik replied to Mahdi Safsafi's topic in RTL and Delphi Object Pascal
Delphi's "Shifting a 1 63 places to the left in a 32-bit variable" is the same as "Shifting a 1 31 places to the left in a 32-bit variable", so you will get $80000000. In the example above, shifting is done in 64bit variable and the result $8000000000000000 is assigned to 32bit typed constant - lower 32bits are used (0) and a warning is generated. -
Strange behavior for literals
Vandrovnik replied to Mahdi Safsafi's topic in RTL and Delphi Object Pascal
Also note this in help: The operations x shl y and x shr y shift the value of x to the left or right by y bits, which (if x is an unsigned integer) is equivalent to multiplying or dividing x by 2^y; the result is of the same type as x. For example, if N stores the value 01101 (decimal 13), then N shl 1 returns 11010 (decimal 26). Note that the value of y is interpreted modulo the size of the type of x. Thus for example, if x is an integer, x shl 40 is interpreted as x shl 8 because an integer is 32 bits and 40 mod 32 is 8. So we have: const P: UInt32 = UInt32(1) shl 63; // contains 2147483648 -
Strange behavior for literals
Vandrovnik replied to Mahdi Safsafi's topic in RTL and Delphi Object Pascal
In help, they write: "If constantExpression is a real, its type is Extended." I believe F1 and F2 are both extended. const F1 = 0.2; F2 = Single(0.2); writeln(F1); writeln(F2); 2.00000000000000E-0001 2.00000002980232E-0001 If F1 was comp, it could save only integer values. -
Depth First Search vs. Breadth First Search in directories
Vandrovnik replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
But TDirectory.GetFiles (System.IOUtils) internally uses FindFirst/FindNext too... -
When I had 10.2 and 10.3 on my PC and uninstalled 10.2 later, help in 10.3 stop working and must be reinstalled.
-
[Android][CameraComponent] How do I get a sharp image with Autofocus or other?
Vandrovnik replied to Fabian1648's topic in FMX
Have you tried to use lower resolution and turn the light on? -
[Android][Delphi Rio] Impossible to set correctly a CameraComponent
Vandrovnik replied to Fabian1648's topic in FMX
I have seen the same problem and have "solved" it this way: Kamera.Quality := FMX.Media.TVideoCaptureQuality.LowQuality; Kamera.Quality := FMX.Media.TVideoCaptureQuality.MediumQuality; -
The declaration must be outside of the form...
-
Did you read, what Cristian Peța linked? function ShutdownBlockReasonCreate(hWnd: HWND; Reason: LPCWSTR): Bool; stdcall; external user32; function ShutdownBlockReasonDestroy(hWnd: HWND): Bool; stdcall; external user32;
-
Record Circular References
Vandrovnik replied to Bernard's topic in Algorithms, Data Structures and Class Design
I believe Anders is right. Class reference is just a pointer - its size is known. When you use this class as a member of another class (fChild: tChild, where tChild is a class), you cannot reference its members in properties (property x: integer read fChild.x). If fChild is a record (fChild: tChild, where tChild is a record), you can reference its members in properties, like in Anders' example (property x: integer read fChild.x). -
Record Circular References
Vandrovnik replied to Bernard's topic in Algorithms, Data Structures and Class Design
If size was the only problem, I can imagine something like this ("human preprocessor"): type tRecordA = record of size 8; tRecordB = record ... function Test: tRecordA; end; tRecordA = record x, y: integer; end; -
Record Circular References
Vandrovnik replied to Bernard's topic in Algorithms, Data Structures and Class Design
Something like a record helper 🙂 I always wonder why there can be just one class/record helper... -
Delphi Rio IDE hangs again and again
Vandrovnik replied to microtronx's topic in Delphi IDE and APIs
Or NativeInt(pointer(... or NativeUInt(pointer(... Just when I see this typecasting pointer to integer, I can't help thinking that 64 bit IDE is far away 🙂 -
Delphi Rio IDE hangs again and again
Vandrovnik replied to microtronx's topic in Delphi IDE and APIs
64 bit IDE would probably require all design time packages to be 64 bit, too... I was surprised to see typecast "integer(pointer(..." in https://blog.marcocantu.com/blog/2020-may-custom-managed-records.html ... -
Function with just underscore _() seems to be valid
Vandrovnik replied to Mike Torrettinni's topic in General Help
With this info in mind, for bad customers you can start programming like that: const _ = 1; _____ = 2; x = _____ + (_-_-_) + 0 + _+0-0+_ ; -
May be https://github.com/neslib/FastMath and/or http://docwiki.embarcadero.com/RADStudio/Rio/en/Floating_point_precision_control_(Delphi_for_x64) can help.
-
Does this data structure exist? TDataStructure<TKey, TKey, TValue, TPayLoad> ?
Vandrovnik replied to PolywickStudio's topic in Algorithms, Data Structures and Class Design
tDictionary alone will not allow you to store more values for the same key (it seems you need it: "I get all values of (TKey1 = 1) for the data. "). You could use two dictionaries: tDictionary<tKey1, tObjectList> tDictionary<tKey2, tObjectList> In these object lists, there will be all objects with corresponding values of the tKey1, resp. tKey2. -
It happens to me +- once every two weeks, too.
-
You mean something like this? type tSledovaniVykonuSeznamVysledku=class(tObjectList<tSledovaniVykonuVysledky>) ... var Cmp: IComparer<tSledovaniVykonuVysledky>; begin Cmp:=tDelegatedComparer<tSledovaniVykonuVysledky>.Create( function(const Left, Right: tSledovaniVykonuVysledky): Integer begin result:=CompareStr(Left.Nazev, Right.Nazev); end); Sort(Cmp);
-
Thank you, AsmProfiler suites the best.
-
Google Chrome is blocking the download of my application — HELP!!!
Vandrovnik replied to Steve Maughan's topic in General Help
I have just tried to download it using Chrome (Czech version 81.0.4044.122 (Oficiální sestavení) (64bitový) ), downloaded without problems, browser allowed me to start the downloaded .exe. -
What about remote debugging?
-
Variant to generic T, how?
Vandrovnik replied to Jacek Laskowski's topic in RTL and Delphi Object Pascal
This compiles, but I have not tested, whether it works as expected 🙂 ToField<T> = class(tObject) private fData : T; protected procedure SetFromVariant(const aValue : Variant); end; procedure ToField<T>.SetFromVariant(const aValue: Variant); var val: TValue; begin val := TValue.FromVariant(aValue); fData := val.AsType<T>; end; -
How do you deal with deprecated symbols in backwards compatible code?
Vandrovnik replied to dummzeuch's topic in RTL and Delphi Object Pascal
Do you have an idea, how many users really need new functions for old versions of Delphi? If there are not many of them, I would suggest to drop support for old versions - you can probably spend your time better than keeping code compatible with old Delphi...