#1 2026-08-20 16:31:31

PierceNg
Member
From: Singapore
Registered: 2023-01-29
Posts: 15
Website

Minor: Typo and function signature clarification

Hi Arnaud,

1 - There's a typo in mormot.lib.curl.pas TCurlOptionName's coForbidResue; in curl.h, this option is CURLOPT_FORBID_REUSE.

2 - In mormot.orm.base.pas, TOrmTableAsbtract's property RowCount is declared as of type PtrInt, ditto the accessor function GetRowCount, but the function implementation returns the field fRowCount, declared type Integer. For clarity of intent, the signature of both RowCount and GetRowCount should return Integer. However, I see code in that unit doing comparisons with PtrUInt(fRowCount), so not sure. My program currently uses RowCount as a test for empty query result set which in its context means the program has opened an invalid SQLite database.

- Pierce

Offline

#2 2026-08-21 07:35:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,595
Website

Re: Minor: Typo and function signature clarification

1. Fixed typo
https://github.com/synopse/mORMot2/commit/fb12e1a6d

2. Don't bother about it. Such internal tricks do not matter. fRowCount is defined as integer for smaller class size.
But when exposed as functions, it uses PtrInt because FPC generates better code with register-size-integers on 64-bit systems.
PtrUInt() is used to check for negative numbers in one asm "cmp" instruction.
The generated asm is correct by all compilers, so there is no bug here. Just (perhaps premature) optimization.
And don't ask an AI about it, it will be lost in the way and hallucinating wrong facts for sure. cool

Offline

#3 2026-08-21 08:47:01

PierceNg
Member
From: Singapore
Registered: 2023-01-29
Posts: 15
Website

Re: Minor: Typo and function signature clarification

Thanks for the explanation on #2. I've never had to write software that cared about that level of optimization, so it's a cool trick to me.

Offline

Board footer

Powered by FluxBB