M4-converting gsize to std::size_t

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

M4-converting gsize to std::size_t

Daniel Boles
There are a few uses of the GLib typedef gsize in glibmm et al.

I presume it would be safe to provide an M4 conversion from this to std::size_t? Do you think that would be good? To me, it seems nicer to use the C++ standard type.

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: M4-converting gsize to std::size_t

Murray Cumming-5
On Fri, 2017-05-26 at 22:11 +0100, Daniel Boles wrote:
> There are a few uses of the GLib typedef gsize in glibmm et al.
>
> I presume it would be safe to provide an M4 conversion from this to
> std::size_t? Do you think that would be good? To me, it seems nicer
> to use the C++ standard type.

Yes, that sounds good. Thanks.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: M4-converting gsize to std::size_t

Daniel Boles
On 29 May 2017 at 15:32, Murray Cumming <[hidden email]> wrote:
On Fri, 2017-05-26 at 22:11 +0100, Daniel Boles wrote:
> There are a few uses of the GLib typedef gsize in glibmm et al.
>
> I presume it would be safe to provide an M4 conversion from this to
> std::size_t? Do you think that would be good? To me, it seems nicer
> to use the C++ standard type.

Yes, that sounds good. Thanks.


Thanks for the confirmation. Does the same apply to other g* types, both the generic ones (guchar, guint, etc.) and the specific-width ones (guint8 to std::uint8_t, etc.) ?



_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: M4-converting gsize to std::size_t

Daniel Boles
gssize makes me wonder: it's supposed to be equivalent to ssize_t, but that's a POSIX thing, not a C/C++ one. We would probably get away with using std::ptrdiff_t, but I'm not sure anything is strictly guaranteed here: https://stackoverflow.com/questions/8649018/what-is-the-difference-between-ssize-t-and-ptrdiff-t


_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: M4-converting gsize to std::size_t

Kjell Ahlstedt-2
In reply to this post by Daniel Boles
Den 2017-05-29 kl. 20:22, skrev Daniel Boles:
On 29 May 2017 at 15:32, Murray Cumming <[hidden email]> wrote:
On Fri, 2017-05-26 at 22:11 +0100, Daniel Boles wrote:
> There are a few uses of the GLib typedef gsize in glibmm et al.
>
> I presume it would be safe to provide an M4 conversion from this to
> std::size_t? Do you think that would be good? To me, it seems nicer
> to use the C++ standard type.

Yes, that sounds good. Thanks.


Thanks for the confirmation. Does the same apply to other g* types, both the generic ones (guchar, guint, etc.) and the specific-width ones (guint8 to std::uint8_t, etc.) ?

Concerning unsigned data types, see what I wrote at https://bugzilla.gnome.org/show_bug.cgi?id=135978#c7:
3. Unsigned data members (e.g. guint32 time) keep their types in gtkmm, instead
of being cast to unsigned int, unsigned short and unsigned char. This is how
unsigned data is usually handled in gtkmm and glibmm. (Don't ask me why gint is
replaced by int, but guint is not replaced by unsigned int. Perhaps because
gmmproc once had problems with type names consisting of more than one word.)
See also the table at the end of https://developer.gnome.org/gtkmm-tutorial/stable/sec-wrapping-hg-files.html.en

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list
Reply | Threaded
Open this post in threaded view
|

Re: M4-converting gsize to std::size_t

Murray Cumming-5
In reply to this post by Daniel Boles
On Mon, 2017-05-29 at 19:22 +0100, Daniel Boles wrote:

> On 29 May 2017 at 15:32, Murray Cumming <[hidden email]> wrote:
> > On Fri, 2017-05-26 at 22:11 +0100, Daniel Boles wrote:
> > > There are a few uses of the GLib typedef gsize in glibmm et al.
> > >
> > > I presume it would be safe to provide an M4 conversion from this
> > to
> > > std::size_t? Do you think that would be good? To me, it seems
> > nicer
> > > to use the C++ standard type.
> >
> > Yes, that sounds good. Thanks.
>
>
> Thanks for the confirmation. Does the same apply to other g* types,
> both the generic ones (guchar, guint, etc.) and the specific-width
> ones (guint8 to std::uint8_t, etc.) ?

Personally, I like the brevity of guint compared to unsigned int, or
even std::uint32_t. But I could maybe be persuaded.

Replacing guint8 with std::uint8_t sounds reasonable, though I doubt
there are many of the min the API anyway.

I guess we could replace many of the 'guchar's with std::byte in C++17.

--
Murray Cumming
[hidden email]
www.murrayc.com

_______________________________________________
gtkmm-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtkmm-list