Re: Moving from C++ to VC++



Doug Harrison [MVP] <dsh@xxxxxxxx> wrote:
> [...]
> > But I really don't see any excuse for not making
> > 'long' 64bit on a 64bit platform.
>
> Portable code can't assume long is larger than 32 bits.

By the same resoning, it can't assume 'long' to
be 32bits. Yet this was named as the reason for
'long' being 32bits on a 64bits platform.

> If you care about
> anything beyond the minimum sizes, you have no business using the native
> types. I know we all violated that with int and 32 bit platforms [...]

I don't think I have ever assumed anything about
any of the integer type except for small (100LOC)
toy programs. (I might have accidently done this,
but then I'd be happy to have my nose pointed at
it.)

> [...] I can't remember the last time I wrote "long" on a 32 bit platform,
> where I know int is 32 bits, and long is the same size. Well, that's not
> entirely true. Like a lot of people, I assumed size_t would fit in an
> unsigned long when using printf and friends and cast accordingly. [...]

I haven't done any of those either.

Maybe that's because I started to work for a
company where all code gets ported to a couple
of platform shortly after starting to work in
this field at all. That teaches a lot about
what you can assume and what you can't.

Schobi

--
SpamTrap@xxxxxx is never read
I'm Schobi at suespammers dot org

"Coming back to where you started is not the same as never leaving"
Terry Pratchett


.