home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17285 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1.7 KB  |  48 lines

  1. Path: sparky!uunet!wupost!gumby!yale!yale.edu!ira.uka.de!smurf.sub.org!flatlin!pilhuhn!spirits!rob
  2. From: rob@spirits.ka.sub.org (Roland Bless)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Enforcer hits at 0000000
  5. Message-ID: <Gjp7s*Wv2@spirits.ka.sub.org>
  6. Date: Sat, 12 Dec 1992 09:58:34 GMT
  7. References: <1g56slINN1p2a@rs1.rrz.Uni-Koeln.DE>
  8. Organization: Blessed Software Products, private, Karlsruhe (FRG)
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=ISO-8859-1
  11. Content-transfer-encoding: 8bit
  12. X-Newsreader: Arn V1.00 pre
  13. Lines: 33
  14.  
  15. In article <1g56slINN1p2a@rs1.rrz.Uni-Koeln.DE>, Wilhelm Stiefelhagen writes:
  16.  
  17. > Last week I tested my Amiga-Programms with Enforcer. I got a lot of
  18. > Enfercer hits of programs reading at adress 00000000. Some of the
  19. > programs are candidates for crashes, some are not.
  20. > Is this enforcer hit so common, and what is the reason?
  21.  
  22. The reason is that you/the programmer forgot to check for NULL-pointers.
  23. Something like:
  24.  
  25. char *text= NULL;
  26. /* text isn't changed */
  27. printf("gaga %s",text);
  28.  
  29. should be better (if text can contain the value NULL):
  30. char *text= NULL;
  31.  
  32. if (text) printf("gaga %s",text);
  33.  
  34. > (The docs of Enforcer said just "lowest page", but I get everytime
  35. > time  (ok, nearly everytime) hits at the absolut lowest adress. So I am a
  36. > little bit concerned.)
  37.  
  38. The main reason are pointers containing NULL that are used without
  39. an if().
  40.  
  41. Regards,
  42.  Roland
  43. --
  44. R o l a n d   B l e s s |UUCP/USENET: rob@spirits.ka.sub.org        IRC: rob|
  45. Groetzinger Strasse 44  |BITNET: UKG5@DKAUNI2.BITNET      FAX: +49211623818 |
  46. 7500 Karlsruhe - FRG    |---------spirits--in--the--material--world---------|
  47. voice +49 721 497381    |           Die Menschheit lernt nie. Aus.          |
  48.