Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | jt@toerring.de (Jens Thoms Toerring) |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Synthetic 'unless' keyword |
| Date | 2016-08-04 23:16 +0000 |
| Organization | Freie Universitaet Berlin |
| Message-ID | <e0i0llFdhonU1@mid.uni-berlin.de> (permalink) |
| References | <e0gh38F2552U1@mid.uni-berlin.de> |
Hi,
to summarize: there don't seem to be anything
"technically broken" with a macro like
#define unless(expr) if (! (expr))
or also
#define until(expr) while (! (expr))
in the sense that there would be cornercases where
it would do something quite different from what it
obviously was intended to do. That's the good side.
Note: I hadn't considered an 'unless' keyword as some-
thing the C language would need urgently, it has done
quite well for a very long time without;-) A macro
like that (maybe just for use in some not too public
projects) would do, as far as I can see.
The other issue is how "disgusting" it is to other
people looking at the code. Of course, there's some
startling factor - there's something that looks like
a keyword, but one you haven't seen before and, while
its meaning looks rather obvious, you can't say for sure
if it really does what you expect until you have hunted
down its definition in sone header file and made sure
that it actually does what you expected. That's a good
argument against using it, at least in code other people
have to work with. And another issue would be constructs
like
unless (something) {
...
} else unless (something_else) {
...
} else {
...
}
or, perhaps worse, mixing 'unless' and 'if',
unless (something) {
....
} else if (something_else) {
...
} else {
...
}
which might be confusing, perhaps mostly due to un-
familiarity.
Do you disagree with these conclusions?
Best regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Synthetic 'unless' keyword jt@toerring.de (Jens Thoms Toerring) - 2016-08-04 09:44 +0000
Re: Synthetic 'unless' keyword David Brown <david.brown@hesbynett.no> - 2016-08-04 12:21 +0200
Re: Synthetic 'unless' keyword Mark Storkamp <mstorkamp@yahoo.com> - 2016-08-04 07:01 -0500
Re: Synthetic 'unless' keyword bert <bert.hutchings@btinternet.com> - 2016-08-04 05:42 -0700
Re: Synthetic 'unless' keyword Keith Thompson <kst-u@mib.org> - 2016-08-04 08:45 -0700
Re: Synthetic 'unless' keyword Philip Lantz <prl@canterey.us> - 2016-08-04 21:55 -0700
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-05 10:08 +0100
Re: Synthetic 'unless' keyword Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-08-05 01:17 -0700
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-05 10:01 +0100
Re: Synthetic 'unless' keyword Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-08-05 04:34 -0700
Re: Synthetic 'unless' keyword Mark Storkamp <mstorkamp@yahoo.com> - 2016-08-05 09:37 -0500
Re: Synthetic 'unless' keyword Malcolm McLean <malcolm.mclean5@btinternet.com> - 2016-08-06 02:28 -0700
Re: Synthetic 'unless' keyword jt@toerring.de (Jens Thoms Toerring) - 2016-08-04 13:38 +0000
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-04 15:04 +0100
Re: Synthetic 'unless' keyword mark.bluemel@gmail.com - 2016-08-04 07:06 -0700
Re: Synthetic 'unless' keyword Keith Thompson <kst-u@mib.org> - 2016-08-04 08:52 -0700
Re: Synthetic 'unless' keyword supercat@casperkitty.com - 2016-08-04 09:45 -0700
Re: Synthetic 'unless' keyword Keith Thompson <kst-u@mib.org> - 2016-08-04 10:23 -0700
Re: Synthetic 'unless' keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-04 19:39 +0100
Re: Synthetic 'unless' keyword supercat@casperkitty.com - 2016-08-04 12:02 -0700
Re: Synthetic 'unless' keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-04 20:33 +0100
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-04 20:42 +0100
Re: Synthetic 'unless' keyword David Brown <david.brown@hesbynett.no> - 2016-08-05 13:14 +0200
Re: Synthetic 'unless' keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-05 12:41 +0100
Re: Synthetic 'unless' keyword mark.bluemel@gmail.com - 2016-08-05 00:53 -0700
Re: Synthetic 'unless' keyword Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-04 16:43 -0400
Re: Synthetic 'unless' keyword David Brown <david.brown@hesbynett.no> - 2016-08-05 13:16 +0200
Re: Synthetic 'unless' keyword jt@toerring.de (Jens Thoms Toerring) - 2016-08-04 23:16 +0000
Re: Synthetic 'unless' keyword Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-05 00:35 +0100
Re: Synthetic 'unless' keyword Tim Rentsch <txr@alumni.caltech.edu> - 2016-08-04 20:13 -0700
Re: Synthetic 'unless' keyword Tim Rentsch <txr@alumni.caltech.edu> - 2016-08-05 04:57 -0700
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-05 13:15 +0100
Re: Synthetic 'unless' keyword Tim Rentsch <txr@alumni.caltech.edu> - 2016-08-18 08:11 -0700
Re: Synthetic 'unless' keyword BartC <bc@freeuk.com> - 2016-08-18 16:36 +0100
Re: Synthetic 'unless' keyword supercat@casperkitty.com - 2016-08-18 10:20 -0700
Re: Synthetic 'unless' keyword Paul N <gw7rib@aol.com> - 2016-08-07 12:56 -0700
csiph-web