home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16834 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.6 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!munnari.oz.au!metro!mama!greyham
  3. From: greyham@research.canon.oz.au (Graham Stoney)
  4. Subject: Re: const char *p == char const *p ?
  5. Message-ID: <Bxzonp.2oH@research.canon.oz.au>
  6. Sender: news@research.canon.oz.au
  7. Organization: Canon Information Systems Research Australia
  8. References: <1992Nov15.162912.17454@news.uiowa.edu> <1992Nov16.010820.26757@cs.tu-berlin.de> <3870@dozo.and.nl>
  9. Date: Fri, 20 Nov 1992 00:43:01 GMT
  10. Lines: 29
  11.  
  12. jos@and.nl (Jos Horsmeier) writes:
  13. >In article <1992Nov16.010820.26757@cs.tu-berlin.de> jutta@opal.cs.tu-berlin.de (Jutta Degener) writes:
  14. >|bonak@herky.cs.uiowa.edu (Esmail Bonakdarian) writes:
  15. >|> Is "char const *p" equivalent to "const char *p"?
  16. >|
  17. >|Yes.  They are both pointers to constant character; you may
  18. >|change the pointer, but not the character it points to.
  19. >|
  20. >|Some programmers prefer "char const *" to "const char *".
  21. >|They argue that C declarations are read "inside out":
  22. >|
  23. >|   char const * p ;
  24. >|                ^     p is a
  25. >|              ^              pointer to
  26. >|        ^^^^^                           constant
  27. >|   ^^^^                                          char
  28. >|
  29. >|But that's just a matter of style.
  30.  
  31. >Sorry, you're making a mistake, `const char * p' is _not_ equivalent
  32. >to `char * const p'. The first declaration reads: `there is a character
  33. >constant, and p points to it', while the second one reads: `this is 
  34. >a character pointer p and it is a constant.' 
  35.  
  36. While Jos it correct in what he says about `char * const p', Jutta is not
  37. making a mistake, since they're talking `const char * p'.
  38.  
  39. regs,
  40. Graham
  41.