home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / docs / misc / ConcNews.lha / news / general.programming / comp.sys.amiga.programmer_22807_000000.msg < prev    next >
Encoding:
Text File  |  1994-11-27  |  1.9 KB  |  57 lines

  1. Path: etek.chalmers.se!chalmers.se!sunic!mcsun!uunet!zaphod.mps.ohio-state.edu!wupost!sdd.hp.com!col.hp.com!fc.hp.com!koren
  2. From: koren@fc.hp.com (Steve Koren)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: SAS6.1 users: please read
  5. Message-ID: <ByM64K.6z2@fc.hp.com>
  6. Date: 2 Dec 92 04:07:32 GMT
  7. Sender: news@fc.hp.com (news daemon)
  8. Organization: Hewlett-Packard Fort Collins Site
  9. Lines: 45
  10. X-Newsreader: Tin 1.1.3 PL5
  11.  
  12. I am posting this note to let SAS 6.1 users know of a serious
  13. problem I have found which can cause insiduous problems with
  14. your code.  I have sent this to EMITS and am just pointing
  15. it out here in hopes someone else can avoid what I ran in to.
  16. I thought twice about posting it here because I do not want
  17. to reflect badly on SASC, which is wonderful in general.  But
  18. I decided that the magnitude of the problem warrents a warning
  19. to other users.  I'm sure they'll fix it right pronto.  SAS has
  20. been very responsive to fixing things reported via EMITS, and
  21. collectively deserve our appriciation for that I think.
  22.  
  23. Consider this code:
  24.  
  25. /***********************************************************************
  26.  **   sc test1.c
  27.  **   slink from lib:c.o test1.o to test1 lib lib:sc.lib
  28.  ***********************************************************************/
  29.  
  30. # include <stdio.h>
  31. # include <string.h>
  32.  
  33. main(int argc, char **argv) {
  34.    char *str = "abc";
  35.    int  num = 7;
  36.  
  37.    if ((strlen(str) - num) > 0) {
  38.       printf("Ooops!\n");
  39.    }
  40.  
  41.    exit(0);
  42. }
  43.  
  44. Even though one would expect
  45.    if ((strlen(str) - num) > 0) {
  46.  
  47. in cases where strlen(str)=3 and num=7 to fail (ie, 3-7 is -4,
  48. and -4 is NOT greater than 0 last time I checked), the if
  49. statement passes instead.
  50.  
  51. I hope this helps someone else avoid the code problems I was
  52. having.  I'm sure they'll fix this for 6.2.  SASC continues,
  53. IMHO, to be the best development environment for the Amiga bar
  54. none.
  55.  
  56.   - steve
  57.