Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Newbie question on time()

Reply
Thread Tools

Newbie question on time()

 
 
Todd Stephens
Guest
Posts: n/a
 
      10-04-2003
Al Bowers wrote in article <blmgn5$dq1eq$(E-Mail Removed)-berlin.de>:

> So you see, the resource that supplied you with this code has
> serious deficiencies. You should seek additional resources like I
> mentioned above.


I shall do just that. I flipped through the rest of the book thinking that
maybe the author used this as merely an early example, but the code
throughout the whole book is missing quite standard pieces. Not once in
the whole book is the main() declared as anything other than just "main()"
and no return value is ever declared either.

--
Todd Stephens
ICQ# 3150790
"A witty saying proves nothing." -Voltaire
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      10-04-2003
Todd Stephens wrote:
>

.... snip ...
>
> It is becoming apparant to me that the book I have is using some
> sort of hackneyed approach to the code. I know the K&R book is
> the definitive guide, but I am led to believe it is not so good
> for teaching from the ground-up in C. Still, I shall probably
> get a copy of it and see how it feels.


If you have a reasonable idea of what programming is about K&R is
an excellent teaching tool. It probably remains the best
introduction to C, and even generic reference, that there is.
That is why it has sold for 25 years, with a single revision 15
years ago.

Don't forget to get the errata, published at:

<http://cm.bell-labs.com/cm/cs/cbook/2ediffs.html>

--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


 
Reply With Quote
 
 
 
 
Todd Stephens
Guest
Posts: n/a
 
      10-04-2003
CBFalconer wrote in article <(E-Mail Removed)>:

> If you have a reasonable idea of what programming is about K&R is
> an excellent teaching tool. It probably remains the best
> introduction to C, and even generic reference, that there is.
> That is why it has sold for 25 years, with a single revision 15
> years ago.


I reread all the reviews on Amazon.com, and found a study/answer guide
companion that goes with it. That looks like a good combination to me, but
I'll have to do some penny-pinching for a while to gather the USD80 that
I'll need. Thanks to everyone for their insight and help with this.

--
Todd Stephens
ICQ# 3150790
"A witty saying proves nothing." -Voltaire
 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      10-04-2003
Zygmunt Krynicki wrote:
>
> On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
>
> > return 0;

>
> return EXIT_SUCCESS;



They mean the same thing.



Brian Rodenborn
 
Reply With Quote
 
Jeremy Yallop
Guest
Posts: n/a
 
      10-04-2003
Todd Stephens wrote:
> CBFalconer wrote in article <(E-Mail Removed)>:
>
>> If you have a reasonable idea of what programming is about K&R is
>> an excellent teaching tool. It probably remains the best
>> introduction to C, and even generic reference, that there is.
>> That is why it has sold for 25 years, with a single revision 15
>> years ago.

>
> I reread all the reviews on Amazon.com, and found a study/answer guide
> companion that goes with it. That looks like a good combination to me, but
> I'll have to do some penny-pinching for a while to gather the USD80 that
> I'll need. Thanks to everyone for their insight and help with this.


It's also worth reading Steve Summit's notes alongside K&R:

http://www.eskimo.com/~scs/cclass/krnotes/top.html

Jeremy.
 
Reply With Quote
 
Ben Pfaff
Guest
Posts: n/a
 
      10-04-2003
Default User <(E-Mail Removed)> writes:

> Zygmunt Krynicki wrote:
> >
> > On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
> >
> > > return 0;

> >
> > return EXIT_SUCCESS;

>
> They mean the same thing.


Yes. However, they are not necessarily equal.
--
Peter Seebach on C99:
"[F]or the most part, features were added, not removed. This sounds
great until you try to carry a full-sized printout of the standard
around for a day."
 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      10-04-2003

"Zygmunt Krynicki" <zyga@_CUT_2zyga.MEdyndns._OUT_org> wrote in message
newsan.2003.10.04.13.39.25.4406@_CUT_2zyga.MEdyn dns._OUT_org...
> On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
>
> > return 0;

>
> return EXIT_SUCCESS;


As the return value from 'main()', both of those
values have the same meaning.

-Mike


 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      10-04-2003
Todd Stephens wrote:
> CBFalconer wrote in article <(E-Mail Removed)>:
>
> > If you have a reasonable idea of what programming is about K&R
> > is an excellent teaching tool. It probably remains the best
> > introduction to C, and even generic reference, that there is.
> > That is why it has sold for 25 years, with a single revision
> > 15 years ago.

>
> I reread all the reviews on Amazon.com, and found a study/answer
> guide companion that goes with it. That looks like a good
> combination to me, but I'll have to do some penny-pinching for a
> while to gather the USD80 that I'll need. Thanks to everyone
> for their insight and help with this.


You don't need any separate study/answer guide. It goes for about
USD40 or so. You might check Barnes and Noble for second hand
copies. Our own Richard Heathfield publishes a set of answers on
his pages.

--
Chuck F ((E-Mail Removed)) ((E-Mail Removed))
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      10-04-2003
Ben Pfaff wrote:
>
> Default User <(E-Mail Removed)> writes:
>
> > Zygmunt Krynicki wrote:
> > >
> > > On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
> > >
> > > > return 0;
> > >
> > > return EXIT_SUCCESS;

> >
> > They mean the same thing.

>
> Yes. However, they are not necessarily equal.



However, it was not a reasonable correction of the posted code.



Brian Rodenborn
 
Reply With Quote
 
Floyd Davidson
Guest
Posts: n/a
 
      10-04-2003
Default User <(E-Mail Removed)> wrote:
>Ben Pfaff wrote:
>> Default User <(E-Mail Removed)> writes:
>> > Zygmunt Krynicki wrote:
>> > > On Fri, 03 Oct 2003 23:59:49 -0400, Al Bowers wrote:
>> > >
>> > > > return 0;
>> > >
>> > > return EXIT_SUCCESS;
>> >
>> > They mean the same thing.

>>
>> Yes. However, they are not necessarily equal.

>
>However, it was not a reasonable correction of the posted code.


Your point is well taken because the two are both equally
acceptable per the Standard, which says,

5 Finally, control is returned to the host environment.
If the value of status is zero or EXIT_SUCCESS, an
implementation-defined form of the status successful
termination is returned. If the value of status is
EXIT_FAILURE, an implementation-defined form of the status
unsuccessful termination is returned. Otherwise the status
returned is implementation-defined.

To me that indicates (as far a C is concerned) there are only
two possible values of status that can be returned, _successful_
and _unsuccessful_. And either a "zero or EXIT_SUCCESS" result
in a unique, singular _successful_ status, making them
necessarily equal.

However, Ben Pfaff is certainly teasing us with something
specific in mind, and I would like to hear him expand on it
because obviously there is more to this than I'm seeing.

--
Floyd L. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VONAGE Newbie w/newbie question New_kid@nowhere.new VOIP 0 08-11-2007 01:40 PM
another newbie question from another newbie.... Lee UK VOIP 4 05-17-2005 04:10 PM
newbie: cisco vlan newbie question No Spam Cisco 3 06-07-2004 10:02 AM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM
Newbie! I'm a newbie! What's wrong with this program? Id0x Python 4 07-20-2003 11:40 PM



Advertisments