Article View: rec.games.programmer
Article #2036Re: Should I learn C or C++ first?
From: Kiwifruit
Date: Fri, 01 Sep 1995 11:34
Date: Fri, 01 Sep 1995 11:34
39 lines
2421 bytes
2421 bytes
rainer@deyke3.fc.hp.com (Rainer Deyke) wrote: >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, while the second is simply obvious to any >programmer above the beginner level. Perhaps sigfunc could be called something more clear, e.g. signalfunc or signalfunction, but I don't see how a heap of obfuscated types is easier to use. After all, the header files for a project are a lot easier to read than the whole source code, and they should show you the architechture of the game. No doubt you refer to file handles and window handles both as ints, even though they are used for completely separate functions. This is silly. I pity the person who has to convert your code to run on another machine. Typedefs add no overhead whatsoever to code size or speed - they simply allow you to write more readable code. There are good reasons for basic computer science techniques, such as named constants, user-defined types and structured code, which is why I use them. Then I know I am not being cursed somewhere by someone who has to work with my code (if they use it at all). Remember, you get paid extra each time your source code is reused. ----------- Carl Muller mullerc@probe.co.uk
Technical Details
Message-ID:
<DE86DD.IGo@news.zippo.com>Path:
arc1-ca.pugleaf.net!news3.noc.netcom.net!zdc!zippo!usenetReferences:
<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
Newsgroups: rec.games.programmer,comp.lang.c++ Path: arc1-ca.pugleaf.net!news3.noc.netcom.net!zdc!zippo!usenet From: mullerc@probe.co.uk (Kiwifruit) Subject: Re: Should I learn C or C++ first? X-Newsreader: Forte Free Agent 1.0.82 Sender: usenet@news.zippo.com Nntp-Posting-Host: 194.129.18.19 Organization: Zippo Message-ID: <DE86DD.IGo@news.zippo.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> Date: Fri, 1 Sep 1995 11:34:10 GMT