[Qt-interest] QSharedMemory::create takes an int... why?
Andrew Hodgkinson
ahodgkinson at endurancetech.co.uk
Fri Jul 31 14:01:41 CEST 2009
Patrick Vollebregt wrote:
> They could solve it by defining an appropriate type, or use what's
> already there: size_t
I completely agree.
The API specifies "int". This data type is signed, so the API specifies a
signed value for an interface in which negative quantities have no
meaning. It would have been possible to defend "unsigned int", but plain
"int" is broken.
The debate herein on the length of "int" is further demonstration of its
poor suitability for this particular interface. It's also worrying to
witness debate on the behaviour of fundamental C++ data types. The ISO
standard should be the first and last word on this subject. If reading
ISO/IEC 14882:2003, please see section 3.9.1.
The suggestion of a "size_t" is sensible. I hope the Qt engineers
recognise the fault and adopt an appropriate solution. For further
information, please see ISO/IEC 14882:2003 section 5.3.3. See also:
http://preview.tinyurl.com/mcpnv4
--
TTFN, Andrew Hodgkinson
Find some electronic music at: Photos, wallpaper, software and more:
http://pond.org.uk/music.html http://pond.org.uk/
More information about the Qt-interest-old
mailing list