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,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) Subject: Re: C is 'better' than Ada because... Date: 1996/07/18 Message-ID: <4sla71$b7g@mulga.cs.mu.OZ.AU>#1/1 X-Deja-AN: 169649944 references: <31E402B4.55EC@csehp3.mdc.com> <4se1cl$mp@salyko.cube.net> <4sgeme$r32@salyko.cube.net> <4skpgu$ta@mulga.cs.mu.OZ.AU> organization: Comp Sci, University of Melbourne newsgroups: comp.lang.ada Date: 1996-07-18T00:00:00+00:00 List-Id: fraser@mundook.cs.mu.OZ.AU (Fraser Wilson) writes: >okellogg@cube.net (Oliver Kellogg) writes: > >> #include >> char *replicate (char c, int times) >> { >> char *buffer = (char *) malloc (times); >> return (char *) memset (buffer, c, times); >> } > >>is not that much less elegant either :-) > >Well, that's a matter of taste. I prefer the Ada version -- the C one >has a lot of really ugly low-level stuff. I mean, typecasts? Neither of the typecasts in the above example are necessary. It could be rewritten as #include #include char *replicate (char c, int times) { return memset (malloc (times), c, times); } However, the fact that the Ada version works whereas the C version is buggy is a pretty strong argument... the C version won't look nearly as elegant once you've fixed the two bugs. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.