home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!munnari.oz.au!metro!usage!news
- From: cameron@cs.unsw.oz.au
- Subject: quick /*NOTREACHED*/ hack for perl ...
- Message-ID: <cameron-921222133520-1-21899@fuligin>
- Sender: news@usage.csd.unsw.OZ.AU
- Nntp-Posting-Host: fuligin.spectrum.cs.unsw.oz.au
- Reply-To: cameron@cs.unsw.oz.au
- Organization: CS&E Computing Facility, Uni Of NSW, Oz
- Errors-To: cameron@cs.unsw.oz.au
- Date: Tue, 22 Dec 1992 02:35:42 GMT
- Return-Receipt-To: cameron@cs.unsw.oz.au
- Lines: 20
-
- This is a runtime check, but can be scatter through code like the lint one,
- as a subroutine call, viz:
- while (1)
- { blah...; last # shouldn't happen ever
- more blah ...
- }
-
- &NOTREACHED;
-
- The code:
-
- sub NOTREACHED { local($package,$filename,$line)=caller;
-
- die "$line of $filename (package $package) should not be reached";
- }
- - Cameron Simpson
- cameron@cs.unsw.oz.au, DoD 0743
- --
- "The engine purrs beneath me with a purpose,
- ready for the pleasure of my hand upon the throttle." - Peter Smith
-