Return or Not?

From: Rich (Someone_at_somewhere.com)
Date: 11/18/04


Date: Thu, 18 Nov 2004 17:24:39 +0000 (UTC)

Hello,

I am still learning C++, and have been reading a couple of books on the
subject, and have learnt a fair bit I feel:)

Now the confusing part, the two books contradict each other in terms of
functions.

One says that it is ok not to return a value, and precede the function
with void, and the other says that a function should always return a
value no matter what, and to always return 0 for success or no zero for
error codes.

The way I see it, I don't see anything wrong with either way, perhaps a
minuscule performance hit on the version that always returns a value.

I was determined when I started to learn C++ that I would at least try
and do it as correctly as possible as I have heard about all the
headaches that can happen due to not doing it properly the first time
around.

Can anyone please tell me whether it is ok to use either method, or if I
should avoid one of them.

Thanks



Relevant Pages

  • Re: MOSFET GOT XTREMELY HOT
    ... books but forgot where. ... That's why I need someone to give me hint. ... You need to do some more reading. ... That's how I learnt this stuff. ...
    (sci.electronics.design)
  • Re: Rambling: the info (+ experiment on reader reaction)
    ... into writing her version of their stories. ... normal and nothing to object to for the characters, ... the fun of reading is the discovery. ... I come to books wanting to enjoy them. ...
    (rec.arts.sf.composition)
  • Re: As a matter of interest
    ... or reading the thread started by spinoza1111 might get some insights ... corporation shifted from producing academically respectable books such ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: How Our Brains Ignore Unpleasant Facts was: Re: The Reasonable
    ... point to your posts that you consider to be most Christlike, ... but either you're not reading what you claim to be reading or ... Biology readings would include two college level text books, ... History includes Barzun's Dawn to Decadence, ...
    (talk.origins)
  • Failure Is Always An Option (LONG)
    ... reading lists customized based on the kid's grade level and test ... books are suitable for their lowest-scoring students. ... Let's now talk about average public high school students, ...
    (rec.audio.opinion)