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,c4d884378fc6b03c X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Two questions Date: 1996/11/07 Message-ID: #1/1 X-Deja-AN: 195627095 references: <32825177.41C6@afit.af.mil> organization: New York University newsgroups: comp.lang.ada Date: 1996-11-07T00:00:00+00:00 List-Id: Ding-yuan Sheu asks I am converting a C++ application into Ada95 and ran into two problems. If you know the answers, please let me know. I appreciate your any help. (2) In a C++ function, prorammers can declare a static local variable to preserve its value between function calls. Can I do that in Ada? Let me address the second question. Yes, of course, this can be done using a package level variable in Ada. Your question makes me suspect that you do not have a good understanding of package structure in Ada. This is a very fundamental part of the language, and it if you are going to do a good job of reengineering a C++ application into Ada, as opposed to a translation at a minimal level that ends up with Ada code looking like C++, then it is important to master the package concept. Straight minimal translation of software seldom makes sense, but you can use the occasion of translation to reengineer and improve the structure of the original, taking advantage of the full capabilities of the target language, but to be able to do that requires a good understanding of both source and target languages. Try going to adahome and following links to some of the very nice online tutorials, you may find these useful for learning more about Ada 95. "Can I .. using a static variable in the subprogram:" this is C terminology and C thinking, there is no such thing as a static variable inside a subprogram in Ada.