home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20306 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.1 KB

  1. Xref: sparky comp.lang.c:20306 comp.lang.c++:20028
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!cs.utexas.edu!geraldo.cc.utexas.edu!emx.cc.utexas.edu!not-for-mail
  3. From: jamshid@emx.cc.utexas.edu (Jamshid Afshar)
  4. Newsgroups: comp.lang.c,comp.lang.c++
  5. Subject: Re: C/C++ Correctness (was: Re: C/C++ Speed)
  6. Date: 27 Jan 1993 13:01:27 -0600
  7. Organization: The University of Texas at Austin, Austin, Texas
  8. Lines: 33
  9. Message-ID: <1k6m67INNgqv@emx.cc.utexas.edu>
  10. References: <1993Jan14.005444.18580@csservices.Princeton.EDU> <1jic36INNhn5@emx.cc.utexas.edu> <1993Jan20.185607.2938@borland.com>
  11. NNTP-Posting-Host: emx.cc.utexas.edu
  12.  
  13. In article <1993Jan20.185607.2938@borland.com> pete@borland.com (Pete Becker) writes:
  14. >In article <1jic36INNhn5@emx.cc.utexas.edu> jamshid@emx.cc.utexas.edu (Jamshid Afshar) writes:
  15.  
  16.     int i;
  17.     int** p = &i;
  18.  
  19. >>Matthias writes:
  20. >>>No, this is definitely a serious type error in ANSI C and *must* be
  21. >>>rejected by the compiler!
  22.  
  23. >>No, it is just a warning in ANSI C.  If you're testing this with BC++
  24. >>3.1, apparently even C compilers have bugs.
  25.  
  26. The reason I wrote this is that I compiled the code in what I thought
  27. was BC++'s strict ANSI C mode.  BC++ gave an error and refused to
  28. compile the code.  I thought Matthias believed type errors like this
  29. are illegal in ANSI C because he was testing with BC++.  As it turns
  30. out, BC++ could not have been the source of his confusion.  I made the
  31. mistake of compiling in C++ mode instead of ANSI C mode.  To sum up,
  32. BC++ does not have any bug in this area.  I don't know where Matthias
  33. got the idea that the above code is not legal ANSI C.
  34.  
  35. >    ANSI C requires that a compiler "issue a diagnostic" for code that does
  36. >not conform to the standard.  It does not require the compiler to refuse to
  37. >compile the program.  Producing a warning satisfies the ANSI requirement.
  38.  
  39. But isn't the above code legal C?  Isn't an ANSI C compiler *required*
  40. to compile the code (and required to issue some kind of warning).  My
  41. point is that the above code will be compiled by an ANSI C compiler,
  42. but not by a C++ compiler.
  43.  
  44. Jamshid Afshar
  45. jamshid@emx.utexas.edu
  46.