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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,782af4edeb84c4b7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: basic basic ada question Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1161268231.345231.242170@m73g2000cwd.googlegroups.com> <4537bc65_1@newsfeed.slurp.net> Date: Sat, 21 Oct 2006 10:19:16 +0200 Message-ID: NNTP-Posting-Date: 21 Oct 2006 10:18:59 CEST NNTP-Posting-Host: 662dcb88.newsspool3.arcor-online.net X-Trace: DXC=\_cmXk;FX@eEB;5>eE0T7mMcF=Q^Z^V3h4Fo<]lROoRagUcjd<3m<;b9S0<9:8SaHb[6LHn;2LCVn[TTLN6oic:T:an\KJd X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7107 Date: 2006-10-21T10:18:59+02:00 List-Id: On Fri, 20 Oct 2006 21:00:33 GMT, Jeffrey R. Carter wrote: > But I've seen plenty of applications that need to process an argument or > two, modifying it before being able to decide what to do with/because of > it. In such cases it may be reasonable to copy the argument. > > In many cases in C, this is done using strcpy into a fixed buffer, > creating a buffer-overflow error. At least this Ada example raises an > exception if the argument won't fit in the buffer. Well, this is a more general issue than just command line arguments. As for me I consider the very idea of tokenizing as harmful. It is unfortunate that both C and Ada follow a wrong concept in the command line interface. Tokenizing is just wasting resources. It is also useless when you have delimiters other than spaces, keyed arguments, or some nested structure. I prefer always to parse the original source: the command line as a whole. I never copy anything. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de