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.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c424d8135e68278 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-12 11:12:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.stealth.net!204.127.161.2.MISMATCH!wn2feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <9v4jsj$bd1$1@infosun2.rus.uni-stuttgart.de> <9v7f26$qn2$1@infosun2.rus.uni-stuttgart.de> <3C1754BA.C4560423@informatik.uni-jena.de> <9v7q8r$1f5$1@infosun2.rus.uni-stuttgart.de> Subject: Re: Ada2005 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Wed, 12 Dec 2001 19:12:28 GMT NNTP-Posting-Host: 204.127.202.211 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1008184348 204.127.202.211 (Wed, 12 Dec 2001 19:12:28 GMT) NNTP-Posting-Date: Wed, 12 Dec 2001 19:12:28 GMT Organization: AT&T Broadband Xref: archiver1.google.com comp.lang.ada:17858 Date: 2001-12-12T19:12:28+00:00 List-Id: "Ted Dennison" wrote in message news:rwNR7.59129$xS6.96048@www.newsranger.com... > In article , Mark Lundquist says... > > > >No... you can do this > > > >in Foo.h: > > > > class Foo { > > static int i; > > . > > . > > > >in Foo.C (typically): > > > > int Foo::i = something; > > Perhaps that might be marginally better for *some* purposes than doing the same > thing with a deferred constant in Ada. If you like the fact that the value is > hidden away in the body, you can get the exact same effect with an inlined > function if you really want to. > No, you misunderstand me... I'm not saying anything is better in C++ or that anything would be better if it were different in Ada. It sounded like you didn't know about static class members, and were saying that static data members were a workaround (to get the effect of a classwide constant). You said something about the stoopidity of having each instance carry around its own copy of a constant, and said (I thought) that the only reason to do that would be because C++ doesn't have anywhere else (like a package) to put it... but they do. > >I think what the OP means is something like a const data member in C++. If > >so, he should learn about discriminants. > > Ahhh. I thought the issue was class-wide constants. Either way though, you can > do this just fine in Ada today. > True of course. My point was just that you can also do that in C++ (you seemed to be denying this). > >> Perhaps there should be a revision in there to include a version of > >> Get_Line implemented as a function. > > > >...such as GNAT's Ada.Strings.Unbounded.Text_IO.Get_Line. I think it would > >be great if that were added to the standard in a language revision. > > Yes; basicly that, but returning "String" instead of > "Ada.Strings.Unbounded.Unbounded_String". Just toss it into Ada.Text_IO and be > done with the whole issue. > There you go. Although I think in practice it wouldn't find as much use as the unbounded version. You usually don't do just one Get_Line... :-). I would guess that GNAT didn't provide this for fixed Strings just because it's useful only in a special case, and using unbounded strings in that case is not all that much less convenient than fixed. Best, -- mark