Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!.POSTED!not-for-mail From: Willem 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: References: 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 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