Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #143210
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c, comp.lang.c++ |
| Subject | Re: Auto-incrementing or auto-decrementing values at compile-time |
| Date | 2019-04-18 21:37 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87y3472gop.fsf@bsb.me.uk> (permalink) |
| References | <q9akd2$km7$1@dont-email.me> |
Cross-posted to 2 groups.
"Rick C. Hodgin" <rick.c.hodgin@gmail.com> writes:
> I have a need fairly often to return distinct values for a return value.
> I don't particularly care what the values are, but they just need to be
> distinct and unique so that if they are returned later I can identify
> the exact cause of the error, where it failed.
<cut>
> Something like coding it this way initially:
>
> int my_function(void)
> {
> if (!test_condition1)
> return #autodec; // Indicate it failed at this test
>
> if (!test_condition2)
> return #autodec; // Indicate it failed at this test
>
> if (!test_condition3)
> return #autodec; // Indicate it failed at this test
>
> // If we get here, we're good
> }
This ties the correctness of every calling function into the order in
which these tests are written. I think it should be added to your
language ASAP.
<cut>
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Auto-incrementing or auto-decrementing values at compile-time "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-18 15:51 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time scott@slp53.sl.home (Scott Lurndal) - 2019-04-18 20:07 +0000
Re: Auto-incrementing or auto-decrementing values at compile-time "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-18 16:42 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time jacobnavia <jacob@jacob.remcomp.fr> - 2019-04-18 23:37 +0200
Re: Auto-incrementing or auto-decrementing values at compile-time fir <profesor.fir@gmail.com> - 2019-04-18 14:46 -0700
Re: Auto-incrementing or auto-decrementing values at compile-time Ian Collins <ian-news@hotmail.com> - 2019-04-19 08:18 +1200
Re: Auto-incrementing or auto-decrementing values at compile-time Bart <bc@freeuk.com> - 2019-04-18 21:25 +0100
Re: Auto-incrementing or auto-decrementing values at compile-time Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-18 21:37 +0100
Re: Auto-incrementing or auto-decrementing values at compile-time "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-18 16:45 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-04-18 21:59 +0100
Re: Auto-incrementing or auto-decrementing values at compile-time Richard Damon <Richard@Damon-Family.org> - 2019-04-19 09:13 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-19 09:25 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time Richard Damon <Richard@Damon-Family.org> - 2019-04-19 12:37 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-19 12:52 -0400
Re: Auto-incrementing or auto-decrementing values at compile-time Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2019-04-19 17:16 -0600
csiph-web