Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]argc loop . . . . . (was: Re: [tlug] Re: font encoding question)
- Date: Tue, 26 Jun 2007 00:23:06 +0900
- From: "Stephen J. Turnbull" <stephen@example.com>
- Subject: argc loop . . . . . (was: Re: [tlug] Re: font encoding question)
- References: <14178ED3A898524FB036966D696494FB139B42@messenger.cv63.navy.mil> <87myyu68b6.fsf@uwakimon.sk.tsukuba.ac.jp> <20070625103300.0fea5bc0.jep200404@columbus.rr.com>
Jim writes: > "Stephen J. Turnbull" wrote: > > > for (i = 0; i <= argc; ++i) > > printf ("There's nothing wrong with Unicode for Japanese.\n"); > > Even though there is no harm since argv[argc] is a null pointer > and *argv[argc] is not accessed, "<= argc" is fingernails on a > chalkboard, neverminding the novel use of argc to control non-argv stuff. Aww, cantcha take a joke? > If one is going to loop on argc, the C idiom is preferred: > > for (i=0;i<argc;i++) > > Also tolerable, but less readable, would be: > > while (*argv++!=(char *)0) Danger, Will Robinson! Danger! Fencepost error! These programs produce too little output! If you insist on accessing the argv array, the correct idiom is do { ... } while (*argv++ != NULL); And yes, the arguments are supposed to be entered individually. No fair using `seq', this is a punishment assignment. ;-)
- Follow-Ups:
- Re: argc loop [tlug]
- From: Jim
- References:
- [tlug] Re: font encoding question
- From: burlingk
- [tlug] Re: font encoding question
- From: Stephen J. Turnbull
- argc loop . . . . . (was: Re: [tlug] Re: font encoding question)
- From: Jim
Home | Main Index | Thread Index
- Prev by Date: Re: Quoting for Thread Breaking Digest Replies (was Re: [tlug] Re: font encoding question)
- Next by Date: Re: Quoting for Thread Breaking Digest Replies (was Re: [tlug] Re: font encoding question)
- Previous by thread: argc loop . . . . . (was: Re: [tlug] Re: font encoding question)
- Next by thread: Re: argc loop [tlug]
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links