[Qt-interest] QSharedMemory::create takes an int... why?

Patrick Vollebregt jeet.nl at gmail.com
Fri Jul 31 13:19:42 CEST 2009


But if I do, I have a to build the framework specific for this purpose, 
change my complete codebase where int suddenly becomes too large.

Now, Qt is most compiled with GCC I guess... so we have a framework 
which DOES support lager files, even on a x86 32bit system.

However, it doesn't support large memory allocations in an LP64 data 
model, which is the most common.

They could solve it by defining an appropriate type, or use what's 
already there: size_t

Still... the memory allocation is even on a 32bit system half of it's 
ability by using a signed instead of an unsigned int.

Is Qt designed with the ILP64 data model as main model in mind, or is it 
*really* intended to be cross platform?

The more I think about it, the more I'm getting the feeling there is a 
design flaw in Qt's memory classes.

Thanks.
> Sorry for the double post, but this made me google around a bit, and
> after it appears that the size of int is depending upon the compiler
> you use. So, to get it to use more than 4 GB you'll have to find a
> compiler that takes int as 64 bit.
>
> 2009/7/31 Thomas Dähling <t.daehling at googlemail.com>:
>   
>> You are also running a 64 Bit OS version? If not, then you get only 32
>> bits because the OS (and the dev libs shipped with it) limit you
>> there.
>>
>> 2009/7/31 Patrick Vollebregt <jeet.nl at gmail.com>:
>>     
>>> Sorry, that's not true.
>>>
>>> On an AMD64 Linux and int in a GCC compiled program is 32 bits.
>>>
>>>
>>>       
>>>> As per definition, int is always the width of the cpu register. So on
>>>> 64 bit machines an int should be 64 bit, while on 16 bit machines it
>>>> should be 16 bit.
>>>>
>>>> /Thomas
>>>>
>>>> 2009/7/31 Patrick Vollebregt <jeet.nl at gmail.com>:
>>>>
>>>>         
>>>>> Hi,
>>>>>
>>>>> Is there a good reason that QSharedMemory::create takes an int?
>>>>>
>>>>> I need to allocate a block of shared memory with a size over 4GB (on a
>>>>> 64bit system), which is not possible with QSharedMemory at the moment.
>>>>>
>>>>> Kind regards,
>>>>>
>>>>> Patrick Vollebregt.
>>>>>
>>>>> _______________________________________________
>>>>> Qt-interest mailing list
>>>>> Qt-interest at trolltech.com
>>>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>>>
>>>>>
>>>>>           
>>>       




More information about the Qt-interest-old mailing list