Re: gint32



On Sun, May 13, 2001 at 12:51:19AM -0400, Brooklyn Linux Solutions CEO wrote:
#include<stdio.h>
#include<stdlib.h>
#include<glib.h>

int main(gint32 argc, gchar ** argv){

Note that main is not called with a 32-bit integer on all platforms.
You should use

    int main(int argc, char *argv[]) {
        . . . .
    }

This is an example where use of gint32 reduces portability.  You have
to use the same declaration as your system, and that means the declaration
I've shown (you can also add char **envp as an optional third argument on
most Unix-like systems).

In general, use gint32 only if you care that you get exactly 32-bits of
integer, even if that makes your program slower.  On a 64-bit or 16-bit
system, gint32 might involve quite a bit more processing, and some
seemingly siply operations might involve a library function (e.g.
integer 32-bit division on a 16-bit system, or 64-bit division on a
32-bit system).

Even if Brooklyn Linux Systems only ever writes Linux code, linux runs
on systems other than the pentium...

(you also want a space after the include in #include, I am not sure
all C compilers will like #include<x.h> instead of #include <x.h>)

Best,

Lee

-- 
Liam Quin - Barefoot in Toronto - liam holoweb net - http://www.holoweb.net/
Ankh: irc.sorcery.net www.valinor.sorcery.net irc.gnome.org www.advogato.org
Author, Open Source XML Database Toolkit, Wiley August 2000
Co-author: The XML Specification Guide, Wiley 1999; Mastering XML, Sybex 2001




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]