From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d89ff62b8449f197,start X-Google-Attributes: gid103376,public From: Huy Vo Subject: Re: Ada and robots Date: 1997/06/30 Message-ID: <9706302316.AA23644@stealth.ctron.com>#1/1 X-Deja-AN: 253744491 Sender: Ada programming language Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Newsgroups: comp.lang.ada Date: 1997-06-30T00:00:00+00:00 List-Id: >In Ada-83, > >when STORAGE_ERROR => > PUT("Storage Error for Module: " & ModuleName & " At line: "); > PUT(LineCount); > raise; > > Naturally this means you must set variables ModuleName (a string) and > LineCount (a positive) in the code. You also need to have > > with TEXT_IO; use TEXT_IO. > > and > > exception > > somewheres. But as your C code didn't mention the #includes required for > the use of stderr, fprintf, and the non-portable definition of __LINE__ > I think this is fair. Especially since the Ada is completely portable. > > Oh yes, the "raise" statement doesn't just give a meaningless error code > (1), it tells the caller that this is a STORAGE_ERROR, and allows them > to use a different technique/algorithm that won't be so > memory-intensive. > Basically you have to hard code the line number in the code? And everytime you add or delete something before that line, you change that hard coded number again? __LINE__ is supposed preprocessed by a program so the programmer doesn't have to count. As to portability, I don't know a C compiler that doesn't have __LINE__. Do you? Do you know of 2 compilers that will not agree on the value of __LINE__ in the following program: #include /* since you insist on having this */ main() { printf("the value of __LINE__ is independent of the compiler %d\n", __LINE__); return 0; }