home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19884 < prev    next >
Encoding:
Text File  |  1993-01-25  |  983 b   |  33 lines

  1. Path: sparky!uunet!ogicse!decwrl!waikato.ac.nz!comp.vuw.ac.nz!cc-server4.massey.ac.nz!pnv.palm.cri.nz!hrpctw
  2. From: hrpctw@pnv.palm.cri.nz (Colin T. Wilson-Salt)
  3. Newsgroups: comp.lang.c++
  4. Subject: Function 'max' should have a prototype
  5. Message-ID: <hrpctw.14@pnv.palm.cri.nz>
  6. Date: 25 Jan 93 21:49:41 GMT
  7. Article-I.D.: pnv.hrpctw.14
  8. Sender: news@massey.ac.nz (USENET News System)
  9. Organization: DSIR, Palmerston North, New Zealand
  10. Lines: 21
  11.  
  12. I can't seem to get the max() macro to work.  It works OK under C, but
  13. under C++ it gives me the error "Function 'max' should have a prototype".
  14.  
  15. I can compile the following example code from the Borland C manual
  16. as TEST.C fine:
  17.  
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. int main(void)
  21. {
  22.     int x = 5, y = 6, z;
  23.     z = max(x, y);
  24.     printf("The larger number is %d\n", z);
  25.     return 0;
  26. }
  27.  
  28. but if I rename the file TEST.CPP it won't compile.
  29.  
  30. Is this an error in the #include file perhaps?
  31.  
  32. Should I give up and write a replacement max() function/macro?
  33.