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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucsdhub!hp-sdd!hplabs!hp-ses!hpcuhb!hpcllla!hpclisp!defaria@hpclapd.HP.COM From: defaria@hpclapd.HP.COM (Andy DeFaria) Newsgroups: comp.lang.ada Subject: Re: Stylistic question: returning strings vs. pointers to strings Message-ID: <920019@hpclapd.HP.COM> Date: 6 Mar 90 17:32:59 GMT References: <10968@june.cs.washington.edu> Organization: Hewlett-Packard Calif. Language Lab List-Id: >/ hpclapd:comp.lang.ada / ka@cs.washington.edu (Kenneth Almquist) / 3:19 pm Mar 5, 1990 / >Being a former C programmer, I naturally made arg(i) return a pointer >to a string, using a separate package named mytypes to contain the >definition of a pointer to a string: > > package mytypes is > type string_ptr is access string; > end mytypes; > > with mytypes; use mytypes; > package args is > function nargs return integer; > function arg(index: integer) return string_ptr; > end args; My question would be why the package mytypes? Why not: package ARGS is type ARG_PTR is access STRING; function NARGS return integer; function ARG (index: integer) return ARG_PTR; end ARGS; It is a tendency for C programmers to use packages as #include files. In my opinion this causes confusion. This example creates a string pointer called ARG_PTR but by its usage it can only point to an command line arguement.