🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #2018

Re: Should I learn C or C++ first?

#2018
From: Pete Becker
Date: Tue, 29 Aug 1995 18:11
42 lines
2223 bytes
In article <41tj89$2hn@deyke3.fc.hp.com>, rainer@deyke3.fc.hp.com says...
>
>Pete Becker (pete@borland.com) wrote:
>: In article <41ki32$p4t@deyke3.fc.hp.com>, rainer@deyke3.fc.hp.com says...
>: >Well, I prefer explicit types because they are so much clearer.  I
>: >consider typedefs to be extremely bad style, but I suppose it is a
>: >matter of personal preference.  The point I was making is that typedefs
>: >aren't necessary in C any more than in C++.  Sorry if I offended you.
>
>: "So much clearer"? Really? Which of these two is easier to read?
>
>: typedef void (*sigfunc)(int);
>: sigfunc signal(int sig, sigfunc func);
>
>: or
>
>: void (*signal(int sig, void (*func)(int)))(int);
>
>Well, for the first you will need to know what sigfunc is defined as
>before you understand it,

Yes, that's true.

> while the second is simply obvious to any
>programmer above the beginner level.
>

Really? I consider myself to be a fair amount above the beginner level, and I 
have to puzzle over things like the second. It's not "simply 
obvious".

>: I am not an idiot, and I will always use the first form rather than the 
>: second. Good code is written clearly, not cleverly.
>
>Well, what's so clear about 'sigfunc'?
>

It does one thing and one thing only. Once you grasp that one thing, it makes 
it much easier to understand what signal does. It's the same strategy we apply 
when we decompose complex operations into a series of simpler ones: divide and 
conquer. Unfortunately, programmers often get caught up in the macho attitude 
that complexity is good because it's challenging. Simpler is better.
Technical Details
Message-ID: <41vl84$q33@druid.borland.com>
Path: arc1-ca.pugleaf.net!druid.borland.com!usenet
References: <40o2ee$aqp@deyke3.fc.hp.com> <DDIE24.Hqw@info.uucp> <41ki32$p4t@deyke3.fc.hp.com> <41nga5$qau@druid.borland.com> <41tj89$2hn@deyke3.fc.hp.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!druid.borland.com!usenet
From: pete@borland.com (Pete Becker)
Newsgroups: rec.games.programmer,comp.lang.c++
Subject: Re: Should I learn C or C++ first?
Date: 29 Aug 1995 18:11:16 GMT
Organization: Borland International
Message-ID: <41vl84$q33@druid.borland.com>
References: <40o2ee$aqp@deyke3.fc.hp.com> <DDIE24.Hqw@info.uucp> <41ki32$p4t@deyke3.fc.hp.com> <41nga5$qau@druid.borland.com> <41tj89$2hn@deyke3.fc.hp.com>
NNTP-Posting-Host: sbcandau.borland.com
Mime-Version: 1.0
Content-Type: Text/Plain; charset=ISO-8859-1
X-Newsreader: WinVN 0.99.5