home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / win32 / 2619 < prev    next >
Encoding:
Text File  |  1992-12-31  |  1.7 KB  |  47 lines

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