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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1901f265c928a511 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail From: Dave Thompson Newsgroups: comp.lang.ada Subject: Re: Typing in Ada Message-ID: References: <_KOuc.24339$IB.6225@attbi_s04> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 10 Jun 2004 03:00:41 GMT NNTP-Posting-Host: 12.75.199.218 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1086836441 12.75.199.218 (Thu, 10 Jun 2004 03:00:41 GMT) NNTP-Posting-Date: Thu, 10 Jun 2004 03:00:41 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:1351 Date: 2004-06-10T03:00:41+00:00 List-Id: On Tue, 01 Jun 2004 01:09:41 GMT, "Peter C. Chapin" wrote: > tmoran@acm.org wrote in news:_KOuc.24339$IB.6225@attbi_s04: > > > How would you do in C the equivalent of > Are you asking me to show you symbolic polynomical manipulation code in C? > I don't understand how that bears on the question of how strongly typed C > is. In any case your example uses features like generic instantiation and > operator overloading that could be more directly mapped to C++. Would you > say that C++ is more strongly typed than C? > Slightly. In C enum types simply are integer types; in C++ they are distinct, though it will silently convert an enum _to_ an integer (not the reverse). And C++ makes character literals type char instead of type int, so overloading on that type has some hope of being usable. (Although char still is, and promotes as, an integer type.) And it does not allow silent conversions _from_ pointer-to-void (which is the moral equivalent of System.Address) to other (data) pointers. (This is actually a specific case of not allowing conversions "down" the class hierarchy, which in general does not apply to C.) And finally, though people don't always think of it as typing, C++ requires the "new" style declaration of routines/methods with parameters specified so calls, and pointers-to-function (and pmfs) if used, can be fully checked*; C supports this but also allows the old K&R1 FORTRANish function-of-you-must-know-the-args. For that matter, C++ and C99, unlike C89 and earlier, no longer have implicit declarations of functions, as taking unspecified arguments and returning int; this isn't really a typing issue, as an implicitly declared function actually has the same type, and gets the same (limited) checking, as an equivalent explicit declaration, but lack of a visible, checkable, and modifiable declaration makes it seem so. * except for varargs -- and C++ default arguments and overloading allow better alternatives in many cases to varargs. - David.Thompson1 at worldnet.att.net