home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 300 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.0 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: 5 Jan 1996 21:12:17 GMT
  6. Organization: Teleport - Portland's Public Access (503) 220-1016
  7. Message-ID: <4ck47h$g07@maureen.teleport.com>
  8. 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
  9. NNTP-Posting-Host: linda.teleport.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Organization: Teleport - Portland's Public Access (503) 220-1016
  13. Distribution: world
  14.  
  15. Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
  16. : In article <4cgo3i$b8n@sunsystem5.informatik.tu-muenchen.de> fischerj@Informatik.TU-Muenchen.DE (Juergen "Rally" Fischer) writes:
  17. : >Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
  18. : >
  19. : >: That doesn't count because in C you don't need to know if this statement
  20. : >: compiles to a .w, to a .l or even to a .q .
  21. : >
  22. : >but when the .l meets a real-world color-register, you will notice
  23. : >your claim is not always true.
  24.  
  25. : If a have to access hardware registers (never had to so far), I will
  26. : not do this by direct pointers, but instead define a structure
  27. : representing them. This is then the only place where I have to worry
  28. : about .c, .w and .l, everywhere else I can write 
  29. : 'chipregs->blt0con = *b++;' and let the compiler figure the rest out.
  30. : HLLs win again here: the compiler will warn if *b is of the wrong
  31. : type, and if I defined the structure wrong (your .w/.l example), I
  32. : just have to correct the structure, not the n statements where it is
  33. : used. And the compiler would even take care of bitshifts where
  34. : necessary.
  35.  
  36.  You let the compiler tell you AFTER you write your code about the type?
  37.  Beleive me, you need to know before you write that line what type
  38.  is chipmems->blt0con... 
  39.  What if blt0con was a pointer to an array of sub structure wich hold
  40.  a pointer to a function that set blt0con according to the video mode?
  41.  Dont you need to know that before you write your code? Do you really
  42.  think the C ocmpiler will convert your line into what is really
  43.  needed to do to set correctly the register? 
  44.  
  45.  I cant see how people can write code without knowing what data or type
  46.  they manipulate...
  47.  
  48. : Your 'move.w (a0)+,(a1)+' doesn't tell you if the '.w' is correct or
  49. : not, unless you read the context and discover that a1 points to the
  50. : chip registers. It doesn't tell you either if the data pointed to by (a0)
  51. : is organized in words or in longwords - it just assumes that it is
  52. : organized in words.
  53.  
  54.  Yea, I agree... move.w (ax)+,(a1)+ just mean : "Copy 2 bytes from a0 to
  55.  a1, and increment both address by 2"
  56.  In C the equivalent to move.? (a0)+,(a1)+ is
  57.  
  58.  A++ = B++;
  59.  
  60.  And that beying defined somewhere:
  61.  
  62.  ushort    *A,*B;
  63.  
  64.  Same thing to me... Aside that in ASM you dont get type checking at
  65.  compile time. 
  66.  
  67.  Do you really write code where you dont know what you are writting?
  68.  
  69.  Stephan
  70.