#1 Today 06:48:26

Kabiri
Member
Registered: 2024-06-22
Posts: 102

FormatUtf8: Is there an internal limit on the number of arguments?

Does mORMot 2 have an internal limit on the number of arguments that can be passed to `FormatUtf8`?

When I pass more than 31 arguments, I get the following exception:

`ESynException: TFormatUtf8: too many arguments`

Is there a built-in limit, or am I doing something wrong?

Offline

#2 Today 16:48:09

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

Re: FormatUtf8: Is there an internal limit on the number of arguments?

There is a limit indeed.

It is hardcoded.

Offline

#3 Today 17:33:20

Kabiri
Member
Registered: 2024-06-22
Posts: 102

Re: FormatUtf8: Is there an internal limit on the number of arguments?

Was there a specific reason for that? Does it cause any additional issues?

Offline

#4 Today 20:09:42

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

Re: FormatUtf8: Is there an internal limit on the number of arguments?

Some temporary allocation is done on the stack, and 31 parameters take 3KB.

Offline

#5 Today 20:11:58

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

Re: FormatUtf8: Is there an internal limit on the number of arguments?

Do you really pass more than 31 arguments to FormatUtf8?
How could it stay on the same line of code?

Use a TTextWriter or a TSynTempAdder then. wink

Offline

Board footer

Powered by FluxBB