Topic: size_t* and unsigned int*
Author: David R Tribble <dtribble@technologist.com>
Date: 1999/06/04 Raw View
James.Kanze@dresdner-bank.com wrote:
>
> Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:
>> Scott D. DeWitt wrote:
>> > I am using CSet++ (xlC) on AIX 4.1.3 to compile an app and am
>> > getting the message that xlC can't convert size_t* to unsigned int*
>> > and vice-versa. size_t is declared as an unsigned int though so
>> > this should be alright. Is this a bug in the compiler or is this
>> > just strict typing?
>>
>> If size_t is defined as unsigned int (this should be documented),
>> then this is a bug, as size_t* and unsigned int* would be _the_
>> _same_ _type_.
>>
>> Actually, I don't believe that. I think that size_t is defined
>> as unsigned long and you didn't noticed that (reading system
>> headers is very difficult, as they are obfuscated by conditional
>> compilation).
>
> On the AIX, both int's and long's are 32 bits, or at least, they were
> on the machine I was working on. On such a machine, it is pretty much
> up to the whim of the compiler writer as to whether size_t is an
> unsigned int or an unsigned long. And it shouldn't matter: the two
> types convert implicitly, and in this case, have the same
> representation and value range.
Yes, but pointers to those two types are not compatible. Valentin
is probably correct.
It would make more sense for size_t to be unsigned int, as this
would make for easier porting to future 64-bit implementations of
AIX. But that's probably not the case; I doubt the writers had
64-bit longs in mind at the time they wrote AIX (which was back
circa 1990 if I recall correctly).
-- David R. Tribble, dtribble@technologist.com --
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: James.Kanze@dresdner-bank.com
Date: 1999/05/31 Raw View
In article <374E8699.ED5@wanadoo.fr>,
Valentin Bonnard <Bonnard.V@wanadoo.fr> wrote:
> Scott D. DeWitt wrote:
> >
> > All:
> >
> > I am using CSet++ (xlC) on AIX 4.1.3 to compile an app and am getting
> > the message that xlC can't convert size_t* to unsigned int* and
> > vice-versa. size_t is declared as an unsigned int though so this should
> > be alright. Is this a bug in the compiler or is this just strict
> > typing?
>
> If size_t is defined as unsigned int (this should be documented),
> then this is a bug, as size_t* and unsigned int* would be _the_
> _same_ _type_.
>
> Actually, I don't believe that. I think that size_t is defined
> as unsigned long and you didn't noticed that (reading system
> headers is very difficult, as they are obfuscated by conditional
> compilation).
On the AIX, both int's and long's are 32 bits, or at least, they were on
the machine I was working on. On such a machine, it is pretty much up
to the whim of the compiler writer as to whether size_t is an unsigned
int or an unsigned long. And it shouldn't matter: the two types convert
implicitly, and in this case, have the same representation and value
range.
I recall vaguely having had the same problem once with xlC, but I cannot
for the life of me remember what it was, or what I had to change to make
it go away.
--
James Kanze mailto:
James.Kanze@dresdner-bank.com
Conseils en informatique orient e objet/
Beratung in objekt orientierter
Datenverarbeitung
Ziegelh ttenweg 17a, 60598 Frankfurt, Germany Tel. +49 (069) 63 19 86
27
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Scott D. DeWitt" <dewittsc@us.ibm.com>
Date: 1999/05/28 Raw View
All:
I am using CSet++ (xlC) on AIX 4.1.3 to compile an app and am getting
the message that xlC can't convert size_t* to unsigned int* and
vice-versa. size_t is declared as an unsigned int though so this should
be alright. Is this a bug in the compiler or is this just strict
typing?
Thanks for any help you can provide,
Scott DeWitt
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/05/28 Raw View
Scott D. DeWitt wrote:
>
> All:
>
> I am using CSet++ (xlC) on AIX 4.1.3 to compile an app and am getting
> the message that xlC can't convert size_t* to unsigned int* and
> vice-versa. size_t is declared as an unsigned int though so this should
> be alright. Is this a bug in the compiler or is this just strict
> typing?
If size_t is defined as unsigned int (this should be documented),
then this is a bug, as size_t* and unsigned int* would be _the_
_same_ _type_.
Actually, I don't believe that. I think that size_t is defined
as unsigned long and you didn't noticed that (reading system
headers is very difficult, as they are obfuscated by conditional
compilation).
--
Valentin Bonnard
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]