home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.win32
- Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!uhf!yps.saar.de!midget.saar.de!tmg
- From: tmg@midget.saar.de (John Tmg)
- Subject: Re: Bizzare array size link errors??
- Organization: Yoyodyne Posting Systems, Midget HQ
- Date: Wed, 30 Dec 1992 15:02:06 GMT
- Message-ID: <C02v3J.GL@midget.yps.saar.de>
- References: <1992Dec22.211411.1147@mala.bc.ca> <1992Dec23.233102.18242@emr1.emr.ca> <1992Dec27.195223.1158@mala.bc.ca>
- Lines: 36
-
- bigras@mala.bc.ca writes:
-
- >> Try this:
- >> printf("%d",1024*1024*4);
- >>
- >> now try this:
- >> printf("%ld",1024L*1024L*4L);
- >>
- >> Is there any difference? Why?
- >>
-
- No there are no differences. ints are 32 Bit, i assume. And calculations
- are always done with ints (as it is the default promotion).
- There is no such thing as a automatic conversion to short. constants
- are ints unless explicitly converted. Look at your manuals :-)
-
- >> I'm not trying to be deliberately obtuse here, but don't
- >> forget to declare your constants long or use a (long) cast.
- >> If you don't they are assumed to be short (if less than 16 bits).
- >> Calculations using short ints where the result is a long will
- >> invariably be wrong.
-
- There are *no* short ints, you see? This is not messy-dos anymore...
- Anyway, just looks like a brain-dead compiler bug (to say the least).
-
- >totally brain-dead?
-
- just the microsoft ones, i guess :-) at least the NT compiler.
-
- >Tony Bigras BIGRAS@MALA.BC.CA
-
- regards, Tilman
- --
- tmg@midget.saar.de i did not go to work today
- Tilman Mueller-Gerbes, Saarbruecken - i think i won't tomorow
- break your chains
-