Article View: comp.lang.misc
Article #2625Re: Complexity of syntax
From: David Gudeman
Date: Tue, 08 Jan 1991 23:19
Date: Tue, 08 Jan 1991 23:19
35 lines
1489 bytes
1489 bytes
In article <1991Jan7.185658.20240@basho.uucp> John Lacey writes: ]brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: ]>Every coding stylebook I've seen recommends that you give names to ]>everything. It's a very good idea, you know. ]... ]Do you really gives names to everything? Every integer constant, ]every string, every character? Or do you let them go nameless? More importantly, do you always give names to intermediate objects? In C you have to give a name to a struct within a function when all you are going to do is return it. For integers you write return i + 1; not res = i + 1; return res; But for structs you have to write res = malloc(sizeof(foo)); res.f1 = x1; res.f2 = x2;...; return res; instead of return res(x1,x2,...); Personally, I think this constitutes an important difference between integers and structs in C. I'm not sure that the term "first class" should be used to make this distinction, though (a few weeks ago I _knew_ that this usage of the term was wrong, but now I'm not so sure). -- David Gudeman gudeman@cs.arizona.edu noao!arizona!gudeman
Technical Details
Message-ID:
<361@coatimundi.cs.arizona.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!ncar!noao!arizona!gudemanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!ncar!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Complexity of syntax Message-ID: <361@coatimundi.cs.arizona.edu> Date: 8 Jan 91 23:19:00 GMT Sender: news@cs.arizona.edu Lines: 35