Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: C standard ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 51 of 89 Topic 26107 of 26960
Post > Topic >>

Re: C standard question?

by Eligiusz Narutowicz<eligiuszdotnaru@[EMAIL PROTECTED] > May 11, 2008 at 08:01 PM

Harald van Dijk <truedfx@[EMAIL PROTECTED]
> writes:

> On Sun, 11 May 2008 09:10:07 -0700, Tomás Ó hÉilidhe wrote:
>> On May 11, 2:29 pm, Chris H <ch...@[EMAIL PROTECTED]
> wrote:
>>> >If anything I would imagine
>>> >it makes the implementation more complex if one tries to enforce a
>>> >specific order between char and unsigned.
>>>
>>> I would have thought if tokens are always in a set order it is easier
>>> to parse.
>> 
>> 
>> Imagine you're writing a program that has commandline options, e.g.:
>> 
>>     prog.exe -t -e -f
>> 
>> Now imagine the code you'd have in main for it. You might have some
sort
>> of switch statement to check whether the command line option is 't' or
>> 'e'. If you were to impose a strict order on the commadline options,
>> then you'd have to keep some sort of list of what previous command line
>> options appeared and in what order. Sounds like a useless and
>> inefficient restriction to me.
>
> This is simpler than allowing options to appear in any order.
>
> if (streq(*argv, "-t")) {
>   opt_t = true;
>   argv++;
> }
>
> if (streq(*argv, "-e")) {
>   opt_e = true;
>   argv++;
> }
>
> if (streq(*argv, "-f")) {
>   opt_f = true;
>   argv++;
> }

I do not see how that is any simpler that a for loop with switch where
there is only one argv++.
 




 89 Posts in Topic:
C standard question?
jan.chludzinski@[EMAIL PR  2008-05-07 11:44:09 
Re: C standard question?
Eric Sosman <Eric.Sosm  2008-05-07 15:20:46 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-07 13:23:50 
Re: C standard question?
Jack Klein <jackklein@  2008-05-07 22:35:23 
Re: C standard question?
rlb@[EMAIL PROTECTED] (R  2008-05-16 10:41:14 
Re: C standard question?
Jack Klein <jackklein@  2008-05-07 22:44:45 
Re: C standard question?
Flash Gordon <spam@[EM  2008-05-07 21:01:48 
Re: C standard question?
CBFalconer <cbfalconer  2008-05-07 18:12:55 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-10 17:06:23 
Re: C standard question?
Richard Heathfield <rj  2008-05-10 17:38:00 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-10 10:52:21 
Re: C standard question?
Eric Sosman <esosman@[  2008-05-10 14:00:19 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-10 10:55:04 
Re: C standard question?
Richard Heathfield <rj  2008-05-10 18:21:24 
Re: C standard question?
Flash Gordon <spam@[EM  2008-05-10 23:55:25 
Re: C standard question?
Thad Smith <ThadSmith@  2008-05-16 21:45:09 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-10 10:55:49 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-10 19:02:58 
Re: C standard question?
Richard Heathfield <rj  2008-05-10 18:18:39 
Re: C standard question?
lawrence.jones@[EMAIL PRO  2008-05-10 14:57:28 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-10 12:08:27 
Re: C standard question?
Eric Sosman <esosman@[  2008-05-10 15:55:11 
Re: C standard question?
richard@[EMAIL PROTECTED]  2008-05-10 20:08:54 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-10 15:55:21 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-10 19:58:26 
Re: C standard question?
CBFalconer <cbfalconer  2008-05-10 16:49:42 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-10 19:49:54 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-10 20:23:51 
Re: C standard question?
"Joachim Schmitz&quo  2008-05-11 10:40:42 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-11 06:10:04 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-11 11:39:18 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-11 11:43:01 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-11 11:42:51 
Re: C standard question?
Spiros Bousbouras <spi  2008-05-11 05:12:19 
Re: C standard question?
santosh <santosh.k83@[  2008-05-12 22:55:09 
Re: C standard question?
Spiros Bousbouras <spi  2008-05-11 05:16:21 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-11 13:47:08 
Re: C standard question?
rlb@[EMAIL PROTECTED] (R  2008-05-13 13:43:40 
Re: C standard question?
Harald van =?UTF-8?b?RMSz  2008-05-11 15:04:33 
Re: C standard question?
Spiros Bousbouras <spi  2008-05-11 06:05:05 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-11 14:23:07 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-11 14:29:36 
Re: C standard question?
David Thompson <dave.t  2008-06-04 05:49:43 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-11 09:10:07 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-11 09:17:12 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-11 12:00:20 
Re: C standard question?
Flash Gordon <spam@[EM  2008-05-11 21:06:51 
Re: C standard question?
fchang@[EMAIL PROTECTED]   2008-05-11 09:49:03 
Re: C standard question?
Ian Collins <ian-news@  2008-05-12 08:01:47 
Re: C standard question?
Harald van =?UTF-8?b?RMSz  2008-05-11 19:02:42 
Re: C standard question?
Eligiusz Narutowicz<el  2008-05-11 20:01:34 
Re: C standard question?
Harald van =?UTF-8?b?RMSz  2008-05-11 20:55:08 
Re: C standard question?
Eligiusz Narutowicz<el  2008-05-11 21:18:44 
Re: C standard question?
Spiros Bousbouras <spi  2008-05-11 12:27:44 
Re: C standard question?
Bart <bc@[EMAIL PROTEC  2008-05-11 13:12:45 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-11 17:21:25 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-12 07:07:52 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-12 07:10:42 
Re: C standard question?
Richard Heathfield <rj  2008-05-12 06:31:11 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-12 09:03:25 
Re: C standard question?
"Default User"   2008-05-12 22:29:06 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-12 16:01:55 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-12 07:54:10 
Re: C standard question?
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-12 02:29:08 
Re: C standard question?
Cromulent <cromulent@[  2008-05-12 10:59:35 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-12 08:58:37 
Re: C standard question?
Ben Bacarisse <ben.use  2008-05-12 18:06:47 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-12 18:53:59 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-12 18:50:14 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-12 18:51:25 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-13 15:14:27 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-13 09:04:48 
Re: C standard question?
Willem <willem@[EMAIL   2008-05-13 16:41:48 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-13 17:39:00 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-13 10:26:23 
Re: C standard question?
David Brown <david.bro  2008-05-13 23:45:00 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-13 17:57:57 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-13 18:27:44 
Re: C standard question?
Willem <willem@[EMAIL   2008-05-13 18:31:29 
Re: C standard question?
Keith Thompson <kst-u@  2008-05-13 12:14:27 
Re: C standard question?
Harald van =?UTF-8?b?RMSz  2008-05-13 19:33:55 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-13 19:55:25 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-13 18:10:48 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-16 12:30:58 
Re: C standard question?
Richard Heathfield <rj  2008-05-16 12:07:19 
Re: C standard question?
pete <pfiland@[EMAIL P  2008-05-16 08:37:25 
Re: C standard question?
Peter Nilsson <airia@[  2008-05-16 22:41:50 
Re: C standard question?
Flash Gordon <spam@[EM  2008-05-17 10:36:59 
Re: C standard question?
Chris H <chris@[EMAIL   2008-05-17 09:05:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 16:39:41 CDT 2008.