[Top][All Lists]

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

Re: int vs. void pointer

From: Niels Grewe
Subject: Re: int vs. void pointer
Date: Mon, 6 Jan 2014 12:37:12 +0000

Am 06.01.2014 um 14:02 schrieb Riccardo Mottola <address@hidden>:

> Hi,
> Niels Grewe wrote:
>> Am 05.01.2014 um 20:45 schrieb Riccardo Mottola <address@hidden>:
>>> Hi,
>>> in reference to:
>>> is it correct to get an int and return it as a void* ? I get a warning 
>>> there.
>>> I suppose int goes to void, not a pointer. perhaps the method shold accept 
>>> a void* as a win?
>> Fred already mentioned to me that I probably missed something when I added 
>> that method, I think I’ll be rolling it back soon.
> Fred is always faster or keener than me :)
> Anyway, no need to roll it back, in case just improve it. I was hinting the 
> same as Markus said, about different data-types which the warning was 
> exposing, but kept my question general.

No, rolling it back was quite the thing to do, I missed the fact that we 
already have a method that serves the same purpose. Actually, I quite agree 
about the dangers of mixing pointers and integers. In this case, however, the 
method (the actual one is -windowDevice:) takes the GNUstep window number as an 
argument and returns the backend dependent window representation, which in the 
case of X11 is a 32 bit integer, but some hypothetical backend could 
potentially use an arbitrary data structure. So using a void* return type and 
requiring the caller to cast it appropriately is probably the way to go.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]