Signed FB_NELEM

14 views
Skip to first unread message

Dimitry Sibiryakov

unread,
Apr 9, 2024, 6:12:52 AMApr 9
to firebir...@googlegroups.com
Number of elements in an array can be negative?

--
WBR, SD.

Alex Peshkoff

unread,
Apr 9, 2024, 7:03:20 AMApr 9
to firebir...@googlegroups.com
On 4/9/24 13:12, 'Dimitry Sibiryakov' via firebird-devel wrote:
> Number of elements in an array can be negative?
>

Definitely not. BTW, if you are here - may be time to use std::size() ?


Dmitry Yemanov

unread,
Apr 9, 2024, 7:22:43 AMApr 9
to firebir...@googlegroups.com
09.04.2024 13:12, 'Dimitry Sibiryakov' via firebird-devel пишет:

>   Number of elements in an array can be negative?

Nope, but fixing that produces almost the same number of warnings as
now, just in different places. They should be addressed in the same
patch, otherwise the fix does not make much sense.


Dmitry

Dimitry Sibiryakov

unread,
Apr 9, 2024, 7:25:37 AMApr 9
to firebir...@googlegroups.com
Dmitry Yemanov wrote 09.04.2024 13:22:
> Nope, but fixing that produces almost the same number of warnings as now, just
> in different places. They should be addressed in the same patch, otherwise the
> fix does not make much sense.

Another question related to warnings: does FB_SIZE_T still have a reason not
to be std::size_t?

--
WBR, SD.

Dmitry Yemanov

unread,
Apr 9, 2024, 8:10:25 AMApr 9
to firebir...@googlegroups.com
09.04.2024 14:25, 'Dimitry Sibiryakov' via firebird-devel пишет:
>
> Another question related to warnings: does FB_SIZE_T still have a
> reason not to be std::size_t?

The same reason as before - our FB_SIZE_T is commonly interchangeable
with ULONG and we're likely to get many more warnings in 64-bit builds
if std::size_t is used.


Dmitry

Alex Peshkoff

unread,
Apr 9, 2024, 8:54:17 AMApr 9
to firebir...@googlegroups.com
Here is one more, may be more important issue. FB_SIZE_T matches a lot
of 'unsigned int' parameters in out API, increasing it causes problems
in some places (i.e. when length of some buffer is returned to the user
it should not be more than MAX_ULONG).


Reply all
Reply to author
Forward
0 new messages