home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12972 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.9 KB  |  50 lines

  1. Path: sparky!uunet!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sun4nl!and!jos
  2. From: jos@and.nl (Jos Horsmeier)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: strstr and ANSI-c
  5. Keywords: strstr ANSI
  6. Message-ID: <3359@dozo.and.nl>
  7. Date: 30 Aug 92 13:19:45 GMT
  8. References: <1992Aug29.215550.11490@daimi.aau.dk>
  9. Organization: AND Software BV Rotterdam
  10. Lines: 38
  11.  
  12. In article <1992Aug29.215550.11490@daimi.aau.dk> pjunold@daimi.aau.dk (Peter Joachim Unold) writes:
  13. |Hello
  14. |
  15. |I've for some time been coding on a program, that must be compiled and run
  16. |on many diff. unix platforms. Apart from the usual portability problems one 
  17. |encounter in unix-programming, I have had problems with users reporting, that
  18. |their ANSI-c compiler reports the 'strstr' string-function unknown. How is 
  19. |that? strstr IS according to my K&C 2. edition part of the standard-library.
  20. |I could ofcause just code my own strstr function, but if one can't expect the
  21. |ANSI-c-compilers to fullfill the ANSI-standard, what can one expect?
  22.  
  23. I assume you're distributing the _source code_ of your program to your
  24. users. Are you sure they're using an ANSI-C conformant compiler? The
  25. strstr() function is definitely part of the standard (paragraph 4.11.5.7)
  26. so ask your users to complain about it to their vendors. 
  27.  
  28. Did you check the `#include <string.h>' line in your source files?
  29. I think you probably did ...
  30.  
  31. Maybe you could include some additional checkpoint sin your code. I've
  32. read about _non_ fonformant compilers that _do_ define __STDC__, but
  33. they define it as a non 1 value. Maybe some paranoic checks like
  34.  
  35. #ifdef __STDC__
  36. #if __STDC__ != 1
  37. /* Include the same file here, just to cause the pre-processor
  38.  * to start complaining, so you'll know something is wrong.
  39.  * You can't use the #error statement here, 'cause the compiler
  40.  * is cheating you ...
  41.  */
  42. #endif
  43. #endif
  44.  
  45. could help you out here ...
  46.  
  47. kind regards,
  48.  
  49. Jos aka jos@and.nl
  50.