Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!.POSTED!not-for-mail |
|---|---|
| From | Willem <willem@toad.stack.nl> |
| Newsgroups | comp.lang.c |
| Subject | Re: To use Perl like conditional assignment in C |
| Date | Sat, 24 Sep 2011 14:06:19 +0000 (UTC) |
| Organization | Eindhoven University of Technology |
| Lines | 27 |
| Message-ID | <slrnj7rour.gnu.willem@toad.stack.nl> (permalink) |
| References | <a2b7378d-3156-4f3c-ad6a-1bf14330d993@5g2000yqo.googlegroups.com> <j5kkg3$io8$1@dont-email.me> |
| NNTP-Posting-Host | toad.stack.nl |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | mud.stack.nl 1316873179 15245 2001:610:1108:5010::135 (24 Sep 2011 14:06:19 GMT) |
| X-Complaints-To | abuse@stack.nl |
| NNTP-Posting-Date | Sat, 24 Sep 2011 14:06:19 +0000 (UTC) |
| User-Agent | slrn/0.9.9p1 (FreeBSD) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c:10862 |
Show key headers only | View raw
Eric Sosman wrote:
) Or, if you prefer, use
)
) cfgval = loadConfig(DEFAULT_VALUE);
)
) where loadConfig() loads and returns the value from the configuration
) file, or returns its own argument if unable to load anything. You
) could even put DEFAULT_VALUE into loadConfig() itself, producing
)
) cfgval = loadConfig();
)
) where loadConfig() loads and returns the file's value if it can, or
) returns DEFAULT_VALUE if unable.
I prefer the first, because of the more real-world generic version:
cfgval = loadConfig('foo_num', FOO_DEFAULT_VALUE);
Which I've used plenty of times.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
To use Perl like conditional assignment in C Ya Shou <shouyatf@gmail.com> - 2011-09-24 04:06 -0700
Re: To use Perl like conditional assignment in C Willem <willem@toad.stack.nl> - 2011-09-24 11:13 +0000
Re: To use Perl like conditional assignment in C pete <pfiland@mindspring.com> - 2011-09-24 07:48 -0400
Re: To use Perl like conditional assignment in C Uno <merrilljensen@q.com> - 2011-09-24 21:58 -0700
Re: To use Perl like conditional assignment in C pete <pfiland@mindspring.com> - 2011-09-25 08:44 -0400
Re: To use Perl like conditional assignment in C Uno <merrilljensen@q.com> - 2011-09-26 21:52 -0700
Re: To use Perl like conditional assignment in C pete <pfiland@mindspring.com> - 2011-09-27 21:14 -0400
Re: To use Perl like conditional assignment in C Keith Thompson <kst-u@mib.org> - 2011-09-27 19:56 -0700
Re: To use Perl like conditional assignment in C Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-09-25 06:53 -0700
Re: To use Perl like conditional assignment in C "J. J. Farrell" <jjf@bcs.org.uk> - 2011-09-26 04:40 +0100
Re: To use Perl like conditional assignment in C Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-24 09:04 -0400
Re: To use Perl like conditional assignment in C Willem <willem@toad.stack.nl> - 2011-09-24 14:06 +0000
Re: To use Perl like conditional assignment in C Ya Shou <shouyatf@gmail.com> - 2011-09-26 21:10 -0700
Re: To use Perl like conditional assignment in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-29 22:08 +0000
Re: To use Perl like conditional assignment in C "BartC" <bc@freeuk.com> - 2011-09-26 01:37 +0100
csiph-web