home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 628 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: nntp.teleport.com!sschaem
  2. From: sschaem@teleport.com (Stephan Schaem)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: PPC compilers
  5. Date: 9 Jan 1996 20:42:21 GMT
  6. Organization: Teleport - Portland's Public Access (503) 220-1016
  7. Distribution: world
  8. Message-ID: <4cujve$dmn@maureen.teleport.com>
  9. References: <john.hendrikx.40ka@grafix.xs4all.nl> <4b77tq$htp@serpens.rhein.de> <MQAQx*XOe@yaps.rhein.de> <4bqhnf$6g5@sunsystem5.informatik.tu-muenchen.de> <jasonb.820051107@cs.uwa.edu.au> <4c9i2l$h3i@sunsystem5.informatik.tu-muenchen.de> <4cf0ep$233@ra.i
  10.  <4ck37m$g07@maureen.teleport.com> <4cs8ce$ljg@ra.ibr.cs.tu-bs.de>
  11. NNTP-Posting-Host: kelly.teleport.com
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
  15. : I need to know if it's a scalar type (further subdivided into integer
  16. : and floating types), an array, a structure, a pointer or else, but I
  17. : do not need to know it's exakt size in byte when using it.
  18.  
  19.  You need to know the type range... if you choose to ignore this, you
  20.  will have to select the largest type avail for real/interger.
  21.  But the point really is you need to know and keep track what your 
  22.  variable are. basicly in asm you write what you are thinking,
  23.  but with a limited range of type and no typedef offered.
  24.  
  25. : Sometimes I don't even need to know the exact type 'cause the compiler
  26. : will create conversion code plus overflow checking (I'm not talking
  27. : just C here).
  28.  
  29.  I think thats a bad practice... just for the fact that you let the
  30.  compiler tell you what you assumed wrong.
  31.  
  32. : In optimum cases, the values of the chipregs have been assigned own
  33. : types, so I can just write 'blt0con_t *b;' or less specific 'int32
  34. : *b;'. Again I don't need to know the size of the type, just which of
  35. : the scalar integer types it is.
  36.  
  37.  Well, what really stop you to think the same way in asembler?
  38.  just treat .w has a type... has long has you know the type of
  39.  your variable in C the compiler wont nag, and you wont get type
  40.  bug in asm (In assmbler the programmer is 'always' right ;)
  41.  
  42. : > Otherwise you need to know that color0 is a word holding 12bit
  43. : > of valid data grouped in 4bit nibles, 
  44.  
  45. : typedef struct {
  46. :   int r : 4;
  47. :   int g : 4;
  48. :   int b : 4;
  49. : } color0_t;
  50.  
  51. : color0_t color0;
  52.  
  53.  Now somewhere one should read the range of r,g,b... or you must
  54.  also provide a set of routine that will work on this structure/type
  55.  (Example: only value from 0 to 12 are valid. But you will make your 
  56.  user function prototype use float and define the valid range)
  57.  
  58.  Stephan
  59.