Size and size_t in dsa API

Started by Ideriha, Takeshiabout 8 years ago4 messageshackers
Jump to latest
#1Ideriha, Takeshi
ideriha.takeshi@jp.fujitsu.com

Hi,

I'm trying to use DSA API and confused a little bit about $subject.

Some type of return value or arguments are defined as size_t
but others are as Size.

Example:
- dsa_area *dsa_create_in_place(void *place, size_t size,
int tranche_id, dsm_segment *segment)

- Size dsa_minimum_size(void)

I'm confused because Size and size_t is virtually equal but
they are mixed in dsa.c. At first I was thinking that there is
some distinguishing convention to use based on some context.

But according to this thread, which seems gone anywhere,
they are same.
/messages/by-id/CAEepm=1eA0vsgA7-2oigKzqg10YeXoPWiS-fCuQRDLwwmgMXag@mail.gmail.com
Are there still someone trying to this?
As a non-expert developer's opinion, I think mixing of Size and size_t makes difficult to understand source code.

===================================================
Takeshi Ideriha
Fujitsu Limited

#2Thomas Munro
thomas.munro@enterprisedb.com
In reply to: Ideriha, Takeshi (#1)
Re: Size and size_t in dsa API

On Thu, Sep 20, 2018 at 6:28 PM Ideriha, Takeshi
<ideriha.takeshi@jp.fujitsu.com> wrote:

As a non-expert developer's opinion, I think mixing of Size and size_t makes difficult to understand source code.

Agreed. Let's change them all to size_t and back-patch that to keep
future back-patching easy. Patch attached.

--
Thomas Munro
http://www.enterprisedb.com

Attachments:

0001-Use-size_t-consistently-in-dsa.-ch.patchapplication/octet-stream; name=0001-Use-size_t-consistently-in-dsa.-ch.patchDownload+53-54
#3Ideriha, Takeshi
ideriha.takeshi@jp.fujitsu.com
In reply to: Thomas Munro (#2)
RE: Size and size_t in dsa API

As a non-expert developer's opinion, I think mixing of Size and size_t makes difficult

to understand source code.

Agreed. Let's change them all to size_t and back-patch that to keep future
back-patching easy. Patch attached.

Thank you for the quick action. I'm happy now.
I confirmed English word Size in comment is kept as it is.

====================
Takeshi Ideriha
Fujitsu Limited

#4Thomas Munro
thomas.munro@enterprisedb.com
In reply to: Ideriha, Takeshi (#3)
Re: Size and size_t in dsa API

On Thu, Sep 20, 2018 at 10:13 PM Ideriha, Takeshi
<ideriha.takeshi@jp.fujitsu.com> wrote:

As a non-expert developer's opinion, I think mixing of Size and size_t makes difficult

to understand source code.

Agreed. Let's change them all to size_t and back-patch that to keep future
back-patching easy. Patch attached.

Thank you for the quick action. I'm happy now.
I confirmed English word Size in comment is kept as it is.

Pushed. Thanks for the reminder about that.

--
Thomas Munro
http://www.enterprisedb.com