Re: [GnomeMeeting-list] 64bit patch
- From: Miguel Rodríguez <migrax terra es>
- To: gnomemeeting-list gnome org
- Subject: Re: [GnomeMeeting-list] 64bit patch
- Date: 09 Oct 2002 12:25:39 +0200
Ummm. It's true that NULL is c++ is defined as 0 (Stroustrup in his book
even mentions that NULL shouldn't be used, and that you should use just
0).
But, doesn't gcc just automatically promote that 0 to 64 bits, as it's
really a pointer?
El mi�09-10-2002 a las 11:37, Alexander Larsson escribi� I'd like this patch to be applied:
>
> Index: src/main_window.cpp
> ===================================================================
> RCS file: /cvs/gnome/gnomemeeting/src/main_window.cpp,v
> retrieving revision 1.117
> diff -u -p -r1.117 main_window.cpp
> --- src/main_window.cpp 6 Oct 2002 21:41:34 -0000 1.117
> +++ src/main_window.cpp 9 Oct 2002 09:26:15 -0000
> @@ -911,7 +911,7 @@ gnomemeeting_init (GmWindow *gw,
> GNOME_PARAM_HUMAN_READABLE_NAME,
> _("GnomeMeeting"),
> GNOME_PARAM_APP_DATADIR, DATADIR,
> - NULL);
> + (void *)NULL);
>
> gm = gnome_app_new ("gnomemeeting", _("GnomeMeeting"));
>
>
> It fixes a bug on 64bit systems.
>
> Scary details:
>
> On 64bit systems int is 32bit and pointers are 64bit, and in C++ NULL is
> defined as 0, not (void *)0 as is common in C[1]. When passing NULL
> through a varargs list (such as above) in C++ the compiler can't know from
> the context wether the 0 is a pointer or an int, so it picks int. On 64bit
> systems this means some random 32 bits of data is used for the other half
> of the pointer in the called function.
>
> [1] The language lawyers among us will probably tell me that C doesn't
> guarantee NULL to be (void *)0 either. This is true, but most C
> implementations use it, and lots of other gtk+/gnome code would break if
> this wasn't the case.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Alexander Larsson Red Hat, Inc
> alexl redhat com alla lysator liu se
> He's a gun-slinging shark-wrestling stage actor on the edge. She's a
> warm-hearted nymphomaniac bodyguard from the wrong side of the tracks. They
> fight crime!
>
> _______________________________________________
> GnomeMeeting-list mailing list
> GnomeMeeting-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnomemeeting-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]