Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is gint, gchar...?

1,100 views
Skip to first unread message

VictoR

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
Please, explain what is gint, gchar...?
What difference are from int, char...?

Thanks a lot.
VictoR


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

tst...@my-deja.com

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
In article <7imd4c$n9k$1...@nnrp1.deja.com>,

VictoR <chu...@my-deja.com> wrote:
> Please, explain what is gint, gchar...?
> What difference are from int, char...?

gint, gchar ..., are not defined by the C standard. They are therefore
likely to be either an extension provided by the compiler or a typedef
from a library. Either read your compiler's documentation, and/or
search any 3rd party library header files for the definition.

--
Tristan Styles #1485

Failure is not an Option
It is Standard Operating Procedure

Ben Pfaff

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
VictoR <chu...@my-deja.com> writes:

Please, explain what is gint, gchar...?
What difference are from int, char...?

They're defined by libglib; beyond that I don't know. I suspect you
could consult the libglib docs at http://www.gtk.org for more
information. They're not standard ANSI C types.
--
"Large amounts of money tend to quench any scruples I might be having."
-- Stephan Wilms

Paul D. Boyle

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
VictoR (chu...@my-deja.com) wrote:
: Please, explain what is gint, gchar...?

: What difference are from int, char...?

This is off topic for comp.lang.c. In standard C there is no type as
'gint' or 'gchar'. My guess is that you are using the glib library
from the gtk+ toolkit. You will find better answers to the questions
you seek by consulting the appropriate newsgroup. Being that there is
no dedicated gtk or gimp newsgroup, the best place to ask this question
might be in comp.os.linux.development.apps because gtk is a widely used
toolkit on that platform.

Paul

--
Paul D. Boyle | bo...@laue.chem.ncsu.edu
Director, X-ray Structural Facility | phone: (919) 515-7362
Department of Chemistry - Box 8204 | FAX: (919) 515-5079
North Carolina State University |
Raleigh, NC, 27695-8204
http://laue.chem.ncsu.edu/web/xray.welcome.html

Nweke, U. (Uzoechi)

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
VictoR wrote:
>
> Please, explain what is gint, gchar...?
> What difference are from int, char...?


Umm, never heard of gint, gchar, I dobut there is such thing, must be a
typo, or something misunderstood. I hope.

Uzo

Kaz Kylheku

unread,
May 28, 1999, 3:00:00 AM5/28/99
to

I think that it might be a typedef from the GLIB library. This is a supporting
library for GTK.

Here is a snippet from /usr/local/include/gint.h on the system that
I'm posting from:

/* GLIB - Library of useful routines for C programming
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*

[ big snip ]

/* Provide type definitions for commonly used types.
* These are useful because a "gint8" can be adjusted
* to be 1 byte (8 bits) on all platforms. Similarly and
* more importantly, "gint32" can be adjusted to be
* 4 bytes (32 bits) on all platforms.
*/

typedef char gchar;
typedef short gshort;
typedef long glong;
typedef int gint;
typedef gint gboolean;

It's funny how even very good programmers get sucked into superstitious rituals
involving useless typedefs that solve imagined porting issues that haven't
actually arisen and never will.
never occur.

Ben Pfaff

unread,
May 28, 1999, 3:00:00 AM5/28/99
to
Tom <marc.bo...@sympatico.ca> writes:

On Dos (and Unix I thing) an integer is 16-bit, on Windows, it's 32-bit. =
Isn't that
an issue?

It's a much more general issue than that. `typedef int gint' is not a
solution. (And all Unices I've of have `int' of at least 32 bits.)
--
"In My Egotistical Opinion, most people's C programs should be indented six
feet downward and covered with dirt." -- Blair P. Houghton

Tom

unread,
May 29, 1999, 3:00:00 AM5/29/99
to
On Dos (and Unix I thing) an integer is 16-bit, on Windows, it's 32-bit. Isn't that
an issue?


Kaz Kylheku a écrit:

--
Anyone uses that signature feature in their mail program?

Robert Brady

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
Ben Pfaff <pfaf...@msu.edu> wrote:
>Tom <marc.bo...@sympatico.ca> writes:

> On Dos (and Unix I thing) an integer is 16-bit, on Windows, it's 32-bit. =


> Isn't that
> an issue?

>It's a much more general issue than that. `typedef int gint' is not a


>solution. (And all Unices I've of have `int' of at least 32 bits.)

I agree the "gint" thing is wacky, but the "gchar" thing is so we can
eventually migrate to "typedef wchar_t gchar".

And please don't forget what the comment was actually talking about, i.e. :

typedef signed char gint8;
typedef unsigned char guint8;
typedef signed short gint16;
typedef unsigned short guint16;
typedef signed int gint32;
typedef unsigned int guint32;

This is sensible. Indeed, they are standardising it.

--
Robert

Kaz Kylheku

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
On Sat, 29 May 1999 00:40:44 GMT, Tom <marc.bo...@sympatico.ca> wrote:
>On Dos (and Unix I thing) an integer is 16-bit, on Windows, it's 32-bit. Isn't that
>an issue?
>
>

>Kaz Kylheku a écrit:
>
>> On Fri, 28 May 1999 12:56:39 -0400, Nweke, U. (Uzoechi)
>> <unw...@eccms1.dearborn.ford.com> wrote:

Please try to follow the Usenet convention of adding your text *after* the
quoted material, and also the practice of trimming replies reasonably.

Kaz Kylheku

unread,
May 31, 1999, 3:00:00 AM5/31/99
to
On 31 May 1999 22:32:22 GMT, Robert Brady <rwb...@ecs.soton.ac.uk> wrote:
>And please don't forget what the comment was actually talking about, i.e. :
>
>typedef signed char gint8;
>typedef unsigned char guint8;
>typedef signed short gint16;
>typedef unsigned short guint16;
>typedef signed int gint32;
>typedef unsigned int guint32;
>
>This is sensible. Indeed, they are standardising it.

It is only sensible when you are writing code that interfaces with specific
hardware, whereby you need to create a memory access having a given width.

Most other uses are simply a case of wanting to continue assembly language
programming in a higher level language.

Martin Ambuhl

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
Tom wrote:
>
> On Dos (and Unix I thing) an integer is 16-bit, on Windows, it's 32-bit. Isn't that
> an issue?

My DOS, Unix, and Winblows compilers all use 32-bit ints. This is not a
platform issue.

--
Martin Ambuhl (mam...@earthlink.net)
Note: mam...@tiac.net will soon be inactive


Richard Krehbiel

unread,
Jun 1, 1999, 3:00:00 AM6/1/99
to
Kaz Kylheku <k...@ashi.FootPrints.net> wrote in message
news:slrn7l667...@ashi.FootPrints.net...

> On 31 May 1999 22:32:22 GMT, Robert Brady <rwb...@ecs.soton.ac.uk> wrote:
> >And please don't forget what the comment was actually talking about, i.e.
:
> >
> >typedef signed char gint8;
> >typedef unsigned char guint8;
> >typedef signed short gint16;
> >typedef unsigned short guint16;
> >typedef signed int gint32;
> >typedef unsigned int guint32;
> >
> >This is sensible. Indeed, they are standardising it.
>
> It is only sensible when you are writing code that interfaces with
specific
> hardware, whereby you need to create a memory access having a given width.

...or you are reading and writing portable binary file formats.
...or you are reading and writing binary streams over a network.

With exact-sized types and ntohl/htonl etc., these problems are solvable.

--
Richard Krehbiel, Kastle Systems, Arlington VA USA
ri...@kastle.com (work) or kreh...@crosslink.net (personal)

0 new messages