Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #21522 > unrolled thread
| Started by | mike3 <mike4ty4@yahoo.com> |
|---|---|
| First post | 2012-05-29 22:44 -0700 |
| Last post | 2012-06-06 08:12 -0700 |
| Articles | 20 on this page of 133 — 38 participants |
Back to article view | Back to comp.lang.c
Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-29 22:44 -0700
Re: Error returns and repeated code, GOTOs, etc. Ike Naar <ike@sverige.freeshell.org> - 2012-05-30 06:38 +0000
Re: Error returns and repeated code, GOTOs, etc. Nils M Holm <news2009@t3x.org> - 2012-05-30 06:57 +0000
Re: Error returns and repeated code, GOTOs, etc. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-30 00:52 -0700
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-30 01:50 -0700
Re: Error returns and repeated code, GOTOs, etc. MarkBluemel <mark_bluemel@pobox.com> - 2012-05-30 09:55 +0100
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 09:18 +0000
Re: Error returns and repeated code, GOTOs, etc. tom st denis <tom@iahu.ca> - 2012-05-30 05:16 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 16:26 +0000
Re: Error returns and repeated code, GOTOs, etc. tom st denis <tom@iahu.ca> - 2012-06-01 08:05 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-06-03 11:24 +0000
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 13:54 +0000
Re: Error returns and repeated code, GOTOs, etc. Jean-Christophe <5.d@free.fr> - 2012-06-02 07:24 -0700
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 16:37 +0000
Re: Error returns and repeated code, GOTOs, etc. Jean-Christophe <5.d@free.fr> - 2012-06-02 12:46 -0700
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 15:42 +0100
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-02 19:35 +0000
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 03:53 +0100
Re: Error returns and repeated code, GOTOs, etc. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-11 18:10 +0300
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-11 16:19 +0100
Re: Error returns and repeated code, GOTOs, etc. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-02 19:27 +0000
Re: Error returns and repeated code, GOTOs, etc. jgk@panix.com (Joe keane) - 2012-06-03 23:48 +0000
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-06-04 11:53 +1200
Re: Error returns and repeated code, GOTOs, etc. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-04 03:32 +0000
Re: Error returns and repeated code, GOTOs, etc. nick_keighley_nospam@hotmail.com - 2012-05-30 07:25 -0700
Re: Error returns and repeated code, GOTOs, etc. falk@rahul.net (Edward A. Falk) - 2012-06-05 07:20 +0000
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-05-30 21:50 +1200
Re: Error returns and repeated code, GOTOs, etc. Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-05-30 03:34 -0700
Re: Error returns and repeated code, GOTOs, etc. Ian Collins <ian-news@hotmail.com> - 2012-05-30 22:57 +1200
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-05-30 11:04 +0000
Re: Error returns and repeated code, GOTOs, etc. nick_keighley_nospam@hotmail.com - 2012-05-30 04:53 -0700
Re: Error returns and repeated code, GOTOs, etc. "BartC" <bc@freeuk.com> - 2012-05-30 13:28 +0100
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-30 13:57 -0700
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-05-30 15:19 +0200
Re: Error returns and repeated code, GOTOs, etc. Mark Bluemel <mark.bluemel@googlemail.com> - 2012-05-31 01:10 -0700
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-06-02 17:34 +0200
Re: Error returns and repeated code, GOTOs, etc. "io_x" <a@b.c.invalid> - 2012-06-03 10:33 +0200
Re: Error returns and repeated code, GOTOs, etc. Ike Naar <ike@iceland.freeshell.org> - 2012-05-30 13:56 +0000
Re: Error returns and repeated code, GOTOs, etc. Kulin <remailer@reece.net.au> - 2012-05-30 17:29 +0000
Re: Error returns and repeated code, GOTOs, etc. ImpalerCore <jadill33@gmail.com> - 2012-05-30 07:13 -0700
Re: Error returns and repeated code, GOTOs, etc. Thad Smith <ThadSmith@acm.org> - 2012-06-02 07:20 -0600
Re: Error returns and repeated code, GOTOs, etc. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-30 16:37 +0100
Re: Error returns and repeated code, GOTOs, etc. Johann Klammer <klammerj@NOSPAM.a1.net> - 2012-05-30 19:05 +0200
Re: Error returns and repeated code, GOTOs, etc. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 13:19 -0700
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-31 13:49 -0700
Re: Error returns and repeated code, GOTOs, etc. "BartC" <bc@freeuk.com> - 2012-05-31 22:08 +0100
Re: Error returns and repeated code, GOTOs, etc. mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:08 -0700
Re: Error returns and repeated code, GOTOs, etc. Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-31 17:34 -0700
Re: Error returns and repeated code, GOTOs, etc. Willem <willem@toad.stack.nl> - 2012-06-01 07:40 +0000
GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:39 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-01 03:21 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 03:49 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 02:15 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 19:45 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 15:00 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-02 16:44 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 03:51 +0100
Re: GOTOs discovered in "real world" program! "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-01 12:06 -0400
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 02:01 +0100
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 19:46 -0700
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-01 21:19 -0700
Re: GOTOs discovered in "real world" program! blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2012-06-02 16:35 +0000
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 14:50 +0100
Re: GOTOs discovered in "real world" program! Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-02 07:04 -0700
Re: GOTOs discovered in "real world" program! "Aaron W. Hsu" <arcfide@sacrideo.us> - 2012-06-02 04:37 -0500
Re: GOTOs discovered in "real world" program! mike3 <mike4ty4@yahoo.com> - 2012-06-02 03:40 -0700
Re: GOTOs discovered in "real world" program! Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-02 14:46 +0100
Re: GOTOs discovered in "real world" program! "BartC" <bc@freeuk.com> - 2012-06-02 17:10 +0100
Re: GOTOs discovered in "real world" program! Robert Wessel <robertwessel2@yahoo.com> - 2012-06-02 11:35 -0500
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "BartC" <bc@freeuk.com> - 2012-06-02 09:46 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 10:43 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "BartC" <bc@freeuk.com> - 2012-06-03 10:58 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 17:18 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-04 20:40 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-05 01:03 +0000
Re: GOTOs discovered in "real world" program! Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-06-04 21:36 -0600
Re: GOTOs discovered in "real world" program! jgk@panix.com (Joe keane) - 2012-06-05 15:13 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ike Naar <ike@sverige.freeshell.org> - 2012-06-05 08:12 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) James Kuyper <jameskuyper@verizon.net> - 2012-06-05 06:00 -0400
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) jgk@panix.com (Joe keane) - 2012-06-05 02:05 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Martin Shobe <martin.shobe@yahoo.com> - 2012-06-05 03:16 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) "io_x" <a@b.c.invalid> - 2012-06-03 17:30 +0200
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Jean-Christophe <5.d@free.fr> - 2012-06-03 09:02 -0700
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-03 22:37 +0100
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Ike Naar <ike@iceland.freeshell.org> - 2012-06-04 07:28 +0000
Re: GOTOs discovered in "real world" program! (was Re: Error returns and repeated code, GOTOs, etc.) Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-08 01:28 -0700
Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-06 02:54 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-06 13:14 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) pete <pfiland@mindspring.com> - 2012-06-06 09:22 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Willem <willem@toad.stack.nl> - 2012-06-06 13:49 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Rui Maciel <rui.maciel@gmail.com> - 2012-06-06 14:56 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-06 10:17 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-06 13:06 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-07 16:26 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-08 14:26 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) mike3 <mike4ty4@yahoo.com> - 2012-06-08 15:19 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Angel <angel+news@spamcop.net> - 2012-06-08 23:32 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-09 01:14 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Jean-Christophe <5.d@free.fr> - 2012-06-09 04:36 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-09 05:54 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-09 16:12 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-06-09 08:44 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-10 18:23 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-10 19:42 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-14 18:00 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-11 01:14 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-12 08:01 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-12 05:27 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "io_x" <a@b.c.invalid> - 2012-06-12 08:44 +0200
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-11 17:24 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) "BartC" <bc@freeuk.com> - 2012-06-11 19:02 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-12 20:03 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-13 00:58 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 06:37 -0400
Evil in Programming Was: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-13 04:50 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) gwowen <gwowen@gmail.com> - 2012-06-13 07:02 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-13 12:47 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 14:17 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Willem <willem@toad.stack.nl> - 2012-06-13 19:44 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 15:52 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-13 17:45 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) James Kuyper <jameskuyper@verizon.net> - 2012-06-13 19:07 -0400
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-14 23:03 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Kaz Kylheku <kaz@kylheku.com> - 2012-06-14 23:25 +0000
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-14 19:25 -0500
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) 88888 Dihedral <dihedral88888@googlemail.com> - 2012-06-17 20:32 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) nick_keighley_nospam@hotmail.com - 2012-06-18 01:30 -0700
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) Les Cargill <lcargill99@comcast.com> - 2012-06-18 07:06 -0500
Re: Why was there a GOTO? Gareth Owen <gwowen@gmail.com> - 2012-06-13 19:57 +0100
Re: Why was there a GOTO? (was Re: GOTOs discovered in "real world" program!) jgk@panix.com (Joe keane) - 2012-06-10 16:56 +0000
Another problem (was Re: Error returns and repeated code, GOTOs, etc.) mike3 <mike4ty4@yahoo.com> - 2012-05-31 16:46 -0700
Re: Another problem (was Re: Error returns and repeated code, GOTOs, etc.) Ian Collins <ian-news@hotmail.com> - 2012-06-01 15:55 +1200
Re: Error returns and repeated code, GOTOs, etc. gwowen <gwowen@gmail.com> - 2012-06-06 08:12 -0700
Page 1 of 7 [1] 2 3 4 5 6 7 Next page →
| From | mike3 <mike4ty4@yahoo.com> |
|---|---|
| Date | 2012-05-29 22:44 -0700 |
| Subject | Error returns and repeated code, GOTOs, etc. |
| Message-ID | <7e54cf3c-d514-407b-a9b6-c0009589d242@ra8g2000pbc.googlegroups.com> |
Hi.
I've got some stuff that looks like this:
---
ErrorCode MyFunc()
{
BigNum a, b, c, d;
ErrorCode rv;
rv = BigNum_Initialize(&a);
if(rv != ERROR_SUCCESS)
return(rv);
rv = BigNum_Initialize(&b);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&a); /* and what if THIS fails??? :) */
return(rv);
}
rv = BigNum_Initialize(&c);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&b);
BigNum_Free(&a);
return(rv);
}
rv = BigNum_Initialize(&d);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&c);
BigNum_Free(&b);
BigNum_Free(&a);
return(rv);
}
/* do some math */
rv = BigNum_Set(&b, 3);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&d);
BigNum_Free(&c);
BigNum_Free(&b);
BigNum_Free(&a);
return(rv);
}
...
/* free buffers */
rv = BigNum_Free(&d);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&c);
BigNum_Free(&b);
BigNum_Free(&a);
return(rv);
}
rv = BigNum_Free(&c);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&b);
BigNum_Free(&a);
return(rv);
}
rv = BigNum_Free(&b);
if(rv != ERROR_SUCCESS)
{
BigNum_Free(&a);
return(rv);
}
rv = BigNum_Free(&a);
if(rv != ERROR_SUCCESS)
return(rv);
return(ERROR_SUCCESS);
}
---
But this is nasty, with all those duplicated "free" blocks. What can
be done to relieve this code duplication? It's ugly, it hurts my
freaking eyes and my nose is screaming for relief. And it hurts
maintainability to no end -- what if we decide to add more capability
to MyFunc() that requires additional bignums? Oy... We'd have to
update _all those blocks_.
I was thinking about using a "goto", but Gotos are Bad, aren't they? I
can't believe I may have to use a goto! What about Djikstra's famous
letter? Is it possible that perhaps a goto may be GOOD here? Because
with a goto this would all seem much simpler. If we violate Djikstra,
we get:
---
ErrorCode MyFunc()
{
BigNum a, b, c, d;
ErrorCode rv;
rv = BigNum_Initialize(&a); if(rv != ERROR_SUCCESS) goto
fail0;
rv = BigNum_Initialize(&b); if(rv != ERROR_SUCCESS) goto
fail1;
rv = BigNum_Initialize(&c); if(rv != ERROR_SUCCESS) goto
fail2;
rv = BigNum_Initialize(&d); if(rv != ERROR_SUCCESS) goto
fail3;
/* do some math */
rv = BigNum_Set(&b, 3); if(rv != ERROR_SUCCESS) goto fail4;
...
/* free buffers */
rv = BigNum_Free(&d); if(rv != ERROR_SUCCESS) goto fail3;
rv = BigNum_Free(&c); if(rv != ERROR_SUCCESS) goto fail2;
rv = BigNum_Free(&b); if(rv != ERROR_SUCCESS) goto fail1;
rv = BigNum_Free(&a); if(rv != ERROR_SUCCESS) goto fail0;
return(ERROR_SUCCESS);
fail4: BigNum_Free(&d);
fail3: BigNum_Free(&c);
fail2: BigNum_Free(&b);
fail1: BigNum_Free(&a);
fail0: return(rv);
}
---
But we've violated Djikstra and we've used a "bad" goto. How would
_you_ write MyFunc() above?
[toc] | [next] | [standalone]
| From | Ike Naar <ike@sverige.freeshell.org> |
|---|---|
| Date | 2012-05-30 06:38 +0000 |
| Message-ID | <slrn3vfsjsbg3h.l1b.ike@sverige.freeshell.org> |
| In reply to | #21522 |
On 2012-05-30, mike3 <mike4ty4@yahoo.com> wrote:
> Hi.
>
> I've got some stuff that looks like this:
>
> [stuff snipped]
>
> But this is nasty, with all those duplicated "free" blocks. What can
> be done to relieve this code duplication? It's ugly, it hurts my
> freaking eyes and my nose is screaming for relief. And it hurts
> maintainability to no end -- what if we decide to add more capability
> to MyFunc() that requires additional bignums? Oy... We'd have to
> update _all those blocks_.
ErrorCode MyFunc(void)
{
BigNum a;
ErrorCode rv = BigNum_Initialize(&a);
if (rv == ERROR_SUCCESS)
{
BigNum b;
rv = BigNum_Initialize(&b);
if (rv == ERROR_SUCCESS)
{
BigNum c;
rv = BigNum_Initialize(&c);
if (rv == ERROR_SUCCESS)
{
BigNum d;
rv = BigNum_Initialize(&d);
if (rv == ERROR_SUCCESS)
{
/* do some math */
rv = BigNum_Set(&b, 3);
if (rv == ERROR_SUCCESS)
{
/* ... */
}
BigNum_Free(&d);
}
BigNum_Free(&c);
}
BigNum_Free(&b);
}
BigNum_Free(&a);
}
return rv;
}
[toc] | [prev] | [next] | [standalone]
| From | Nils M Holm <news2009@t3x.org> |
|---|---|
| Date | 2012-05-30 06:57 +0000 |
| Message-ID | <a2lumlFllU1@mid.individual.net> |
| In reply to | #21522 |
mike3 <mike4ty4@yahoo.com> wrote: > But this is nasty, with all those duplicated "free" blocks. What can > be done to relieve this code duplication? [...] Add a garbage collector for BigNums. -- Nils M Holm < n m h @ t 3 x . o r g > www.t3x.org
[toc] | [prev] | [next] | [standalone]
| From | Malcolm McLean <malcolm.mclean5@btinternet.com> |
|---|---|
| Date | 2012-05-30 00:52 -0700 |
| Message-ID | <d123c6a4-70d6-4db6-82c2-ab70b6c34c53@googlegroups.com> |
| In reply to | #21522 |
בתאריך יום רביעי, 30 במאי 2012 06:44:06 UTC+1, מאת mike3: > > But we've violated Djikstra and we've used a "bad" goto. How would > _you_ write MyFunc() above? > I use gotos for handling memory allocation failures, but almost never for any other purpose. -- Basic Algorithms - ANSI C source for fundamental programming operations. http://www.malcolmmclean.site11.com/www
[toc] | [prev] | [next] | [standalone]
| From | mike3 <mike4ty4@yahoo.com> |
|---|---|
| Date | 2012-05-30 01:50 -0700 |
| Message-ID | <bc6e5f18-45a4-42e2-9dc7-513b6bd5dead@h10g2000pbi.googlegroups.com> |
| In reply to | #21525 |
On May 30, 1:52 am, Malcolm McLean <malcolm.mcle...@btinternet.com> wrote: > בתאריך יום רביעי, 30 במאי 2012 06:44:06 UTC+1, מאת mike3: > > > But we've violated Djikstra and we've used a "bad" goto. How would > > _you_ write MyFunc() above? > > I use gotos for handling memory allocation failures, but almost never for any other purpose. So what would you do in the above circumstance?
[toc] | [prev] | [next] | [standalone]
| From | MarkBluemel <mark_bluemel@pobox.com> |
|---|---|
| Date | 2012-05-30 09:55 +0100 |
| Message-ID | <jq4nar$lvm$1@dont-email.me> |
| In reply to | #21522 |
On 05/30/2012 06:44 AM, mike3 wrote:
> But we've violated Djikstra and we've used a "bad" goto. How would
> _you_ write MyFunc() above?
I personally don't like the infinitely indented if approach...
In C, I think it's probably OK to use goto for "exception handling".
If you have some way of indicating that a BigNum is uninitialised (e.g.
a BIGNUM_NULL macro) and you make BigNum_Free() set the BigNum to this
value, you could use something like this - goto-rich but less repetitive:-
ErrorCode MyFunc()
{
BigNum a = BIGNUM_NULL;
BigNum b = BIGNUM_NULL;
BigNum c = BIGNUM_NULL;
BigNum d = BIGNUM_NULL;
ErrorCode rv;
rv = BigNum_Initialize(&a);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Initialize(&b);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Initialize(&c);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Initialize(&d);
if(rv != ERROR_SUCCESS)
goto failed;
/* do some math */
rv = BigNum_Set(&b, 3);
if(rv != ERROR_SUCCESS)
goto failed;
...
/* free buffers */
rv = BigNum_Free(&d);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Free(&c);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Free(&b);
if(rv != ERROR_SUCCESS)
goto failed;
rv = BigNum_Free(&a);
if(rv != ERROR_SUCCESS)
goto failed;
return(ERROR_SUCCESS);
failed: /* we'll try and clean up, but won't care too much if it fails */
if (d != BIGNUM_NULL)
BigNum_Free(&d);
if (c != BIGNUM_NULL)
BigNum_Free(&c);
if (b != BIGNUM_NULL)
BigNum_Free(&b);
if (a != BIGNUM_NULL)
BigNum_Free(&a);
return(rv);
}
[toc] | [prev] | [next] | [standalone]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Date | 2012-05-30 09:18 +0000 |
| Message-ID | <slrnjsbpfu.1n9u.willem@toad.stack.nl> |
| In reply to | #21528 |
MarkBluemel wrote:
) On 05/30/2012 06:44 AM, mike3 wrote:
)
)> But we've violated Djikstra and we've used a "bad" goto. How would
)> _you_ write MyFunc() above?
)
) I personally don't like the infinitely indented if approach...
)
) In C, I think it's probably OK to use goto for "exception handling".
)
) If you have some way of indicating that a BigNum is uninitialised (e.g.
) a BIGNUM_NULL macro) and you make BigNum_Free() set the BigNum to this
) value, you could use something like this - goto-rich but less repetitive:-
Rewritten to get rid of the gotos:
ErrorCode DoMath(BigNum a, BigNum b. BigNum c, BigNum d)
{
ErrorCode rv;
/* do some math */
rv = BigNum_Set(&b, 3);
if (rv != ERROR_SUCCESS) return rv;
...
return ERROR_SUCCESS;
}
ErrorCode MyFunc()
{
BigNum a = BIGNUM_NULL;
BigNum b = BIGNUM_NULL;
BigNum c = BIGNUM_NULL;
BigNum d = BIGNUM_NULL;
ErrorCode rv = ERROR_SUCCESS;
if (rv == ERROR_SUCCESS) rv = BigNum_Initialize(&a);
if (rv == ERROR_SUCCESS) rv = BigNum_Initialize(&b);
if (rv == ERROR_SUCCESS) rv = BigNum_Initialize(&c);
if (rv == ERROR_SUCCESS) rv = BigNum_Initialize(&d);
if (rv == ERROR_SUCCESS) rv = DoMath(a, b, c, d);
/* BigNum_Free should check for BIGNUM_NULL itself */
BigNum_Free(&d);
BigNum_Free(&c);
BigNum_Free(&b);
BigNum_Free(&a);
return rv;
}
If you want to be more concise, you can make ERROR_SUCCESS equal 0,
and then you can simply do:
rv = BigNum_Initialize(&a) || ... || BigNum_Set(&b, 3) || BigNum_AddTo(&a, &b) || ... ;
Which will short-circuit at the first failure.
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
[toc] | [prev] | [next] | [standalone]
| From | tom st denis <tom@iahu.ca> |
|---|---|
| Date | 2012-05-30 05:16 -0700 |
| Message-ID | <45cf2e8a-f8cb-4781-977a-2fd7ad31ba39@st3g2000pbc.googlegroups.com> |
| In reply to | #21529 |
On May 30, 5:18 am, Willem <wil...@toad.stack.nl> wrote: > If you want to be more concise, you can make ERROR_SUCCESS equal 0, > and then you can simply do: > > rv = BigNum_Initialize(&a) || ... || BigNum_Set(&b, 3) || BigNum_AddTo(&a, &b) || ... ; > > Which will short-circuit at the first failure. Which in a sufficiently complicated function like an ECC point add/ double would result in spaghetti code and your termination. :-) The "if (err == OK) ..." method is cool but frankly I just like the goto's when I'm writing out something the long way. Tom
[toc] | [prev] | [next] | [standalone]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Date | 2012-05-30 16:26 +0000 |
| Message-ID | <slrnjscii7.2aju.willem@toad.stack.nl> |
| In reply to | #21537 |
tom st denis wrote:
) On May 30, 5:18?am, Willem <wil...@toad.stack.nl> wrote:
)> If you want to be more concise, you can make ERROR_SUCCESS equal 0,
)> and then you can simply do:
)>
)> ? ? rv = BigNum_Initialize(&a) || ... || BigNum_Set(&b, 3) || BigNum_AddTo(&a, &b) || ... ;
)>
)> Which will short-circuit at the first failure.
)
) Which in a sufficiently complicated function like an ECC point add/
) double would result in spaghetti code and your termination. :-)
How can it be spaghetti when it's a single line of calls, one after
the other? Spaghetti code is meant to be tangled, isn't it?
) The "if (err == OK) ..." method is cool but frankly I just like the
) goto's when I'm writing out something the long way.
I've seen the (err == OK) method used too much in code that didn't require
cleanup at end of function. Apparently somebody at our company believes in
'one-function-one-return' religiously. I agree gotos are better.
Another method is to have all 'bignum' functions check for 'error' inputs
and generate 'error' outputs when they encounter them (or whenever they
encounter an error), and then you only have to check for an 'error'
result at the very end.
Something like:
int DoCalc()
{
int rv;
BigNum a;
BigNum b;
BigNum c;
BigNum d;
BigNum_Init(&a);
BigNum_Init(&b);
BigNum_Init(&c);
BigNum_Init(&d);
BigNum_Set(&a, 3);
BigNum_Set(&b, 5);
...
BigNum_Multiply(&c, &d);
...
if ((rv = BigNum_GetError(&d)) != ERROR_SUCCESS) return rv;
BigNum_Print("The result is: %bn", &d);
BigNum_Free(&a);
BigNum_Free(&b);
BigNum_Free(&c);
BigNum_Free(&d);
return ERROR_SUCCESS;
}
The only weirdside to this is when a value is not used in the final result,
then that value will not be checked for errors.
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
[toc] | [prev] | [next] | [standalone]
| From | tom st denis <tom@iahu.ca> |
|---|---|
| Date | 2012-06-01 08:05 -0700 |
| Message-ID | <cb400ea0-dd56-4349-b05d-2a0bfba3e43f@kw17g2000pbb.googlegroups.com> |
| In reply to | #21548 |
On May 30, 12:26 pm, Willem <wil...@toad.stack.nl> wrote:
> tom st denis wrote:
>
> ) On May 30, 5:18?am, Willem <wil...@toad.stack.nl> wrote:
> )> If you want to be more concise, you can make ERROR_SUCCESS equal 0,
> )> and then you can simply do:
> )>
> )> ? ? rv = BigNum_Initialize(&a) || ... || BigNum_Set(&b, 3) || BigNum_AddTo(&a, &b) || ... ;
> )>
> )> Which will short-circuit at the first failure.
> )
> ) Which in a sufficiently complicated function like an ECC point add/
> ) double would result in spaghetti code and your termination. :-)
>
> How can it be spaghetti when it's a single line of calls, one after
> the other? Spaghetti code is meant to be tangled, isn't it?
>
> ) The "if (err == OK) ..." method is cool but frankly I just like the
> ) goto's when I'm writing out something the long way.
>
> I've seen the (err == OK) method used too much in code that didn't require
> cleanup at end of function. Apparently somebody at our company believes in
> 'one-function-one-return' religiously. I agree gotos are better.
>
> Another method is to have all 'bignum' functions check for 'error' inputs
> and generate 'error' outputs when they encounter them (or whenever they
> encounter an error), and then you only have to check for an 'error'
> result at the very end.
>
> Something like:
>
> int DoCalc()
> {
> int rv;
> BigNum a;
> BigNum b;
> BigNum c;
> BigNum d;
>
> BigNum_Init(&a);
> BigNum_Init(&b);
> BigNum_Init(&c);
> BigNum_Init(&d);
>
> BigNum_Set(&a, 3);
> BigNum_Set(&b, 5);
> ...
> BigNum_Multiply(&c, &d);
> ...
> if ((rv = BigNum_GetError(&d)) != ERROR_SUCCESS) return rv;
>
> BigNum_Print("The result is: %bn", &d);
> BigNum_Free(&a);
> BigNum_Free(&b);
> BigNum_Free(&c);
> BigNum_Free(&d);
>
> return ERROR_SUCCESS;
>
> }
>
> The only weirdside to this is when a value is not used in the final result,
> then that value will not be checked for errors.
That only works if you capture the error codes in your bignum
structure otherwise it's not thread safe.
Tom
[toc] | [prev] | [next] | [standalone]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Date | 2012-06-03 11:24 +0000 |
| Message-ID | <slrnjsmiba.858.willem@toad.stack.nl> |
| In reply to | #21628 |
tom st denis wrote:
) On May 30, 12:26?pm, Willem <wil...@toad.stack.nl> wrote:
)> Another method is to have all 'bignum' functions check for 'error' inputs
)> and generate 'error' outputs when they encounter them (or whenever they
)> ?encounter an error), and then you only have to check for an 'error'
)> result at the very end.
)>
)> Something like:
<snip>
)> The only weirdside to this is when a value is not used in the final result,
)> then that value will not be checked for errors.
)
) That only works if you capture the error codes in your bignum
) structure otherwise it's not thread safe.
I don't see any way to implement what I described other than storing
the error codes in the bignum structures.
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
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-02 13:54 +0000 |
| Message-ID | <jqd5ug$gt0$2@reader1.panix.com> |
| In reply to | #21548 |
In article <slrnjscii7.2aju.willem@toad.stack.nl>,
Willem <willem@toad.stack.nl> wrote:
>I agree gotos are better.
I agree gotos are better.
int func(int x)
{
int err;
struct bar *a;
struct bar *b;
struct bar *c;
int err2;
err = allocate_bar(&a);
if (err != X_OK)
goto done;
err = allocate_bar(&b);
if (err != X_OK)
goto free_a;
err = allocate_bar(&c);
if (err != X_OK)
goto free_b;
...
/* normal exit */
err = free_bar(c);
err2 = free_bar(b);
err = err != X_OK ? err : err2;
err2 = free_bar(a);
err = err != X_OK ? err : err2;
return err;
/* error exit */
err2 = free_bar(c);
(void) err2;
free_b:
err2 = free_bar(b);
(void) err2;
free_a:
err2 = free_bar(a);
(void) err2;
done:
return err;
}
do that in C++!
[toc] | [prev] | [next] | [standalone]
| From | Jean-Christophe <5.d@free.fr> |
|---|---|
| Date | 2012-06-02 07:24 -0700 |
| Message-ID | <a77db563-a307-4c82-a32d-18fbc238afec@cu1g2000vbb.googlegroups.com> |
| In reply to | #21677 |
On Jun 2, 3:54 pm, j...@panix.com (Joe keane) wrote:
> I agree gotos are better.
#define SIZE 3
int func(int x)
{
int i, err;
struct bar *s[SIZE];
// init
for( err=X_OK, i=0; (err==X_OK) && (i<SIZE); i++ )
err = allocate_bar( &s[i] );
// check success
if( err == X_OK )
{ // process ...
}
// free only allocated bar(s)
while( --i >= 0 ) free_bar( s[i] );
// done
return err; // zero = success
}
> int func(int x)
> {
> int err;
> struct bar *a;
> struct bar *b;
> struct bar *c;
> int err2;
>
> err = allocate_bar(&a);
> if (err != X_OK)
> goto done;
>
> err = allocate_bar(&b);
> if (err != X_OK)
> goto free_a;
>
> err = allocate_bar(&c);
> if (err != X_OK)
> goto free_b;
>
> ...
>
> /* normal exit */
>
> err = free_bar(c);
>
> err2 = free_bar(b);
> err = err != X_OK ? err : err2;
>
> err2 = free_bar(a);
> err = err != X_OK ? err : err2;
> return err;
>
> /* error exit */
>
> err2 = free_bar(c);
> (void) err2;
>
> free_b:
> err2 = free_bar(b);
> (void) err2;
>
> free_a:
> err2 = free_bar(a);
> (void) err2;
>
> done:
> return err;
> }
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-02 16:37 +0000 |
| Message-ID | <jqdfgn$o5b$1@reader1.panix.com> |
| In reply to | #21685 |
In article <a77db563-a307-4c82-a32d-18fbc238afec@cu1g2000vbb.googlegroups.com>,
Jean-Christophe <5.d@free.fr> wrote:
>#define SIZE 3
>int func(int x)
>{
>int i, err;
>struct bar *s[SIZE];
>
>// init
> for( err=X_OK, i=0; (err==X_OK) && (i<SIZE); i++ )
> err = allocate_bar( &s[i] );
>
>// check success
> if( err == X_OK )
> { // process ...
> }
>
>// free only allocated bar(s)
> while( --i >= 0 ) free_bar( s[i] );
>
>// done
>return err; // zero = success
>}
I used 'struct bar',
for all of them,
for sake of example.
It's very likely that in real world code
they are all different types,
with different functions to allocate them and unallocate them,
and so some code to iterate over them is likely to be
some more confusing than helpful.
If they are the same type,
such that you can put them in an array,
then of course what you say is better.
[toc] | [prev] | [next] | [standalone]
| From | Jean-Christophe <5.d@free.fr> |
|---|---|
| Date | 2012-06-02 12:46 -0700 |
| Message-ID | <3e67612a-3aff-4bf4-8c84-53e2092f1093@3g2000vbx.googlegroups.com> |
| In reply to | #21695 |
On 2 juin, 18:37, j...@panix.com (Joe keane) : > I used 'struct bar', > for all of them, for sake of example. > It's very likely that in real world code > they are all different types, > with different functions to allocate them and unallocate them, > and so some code to iterate over them is likely to be > some more confusing than helpful. I'd rather encapsulate functions pointers ( allocate, init, ... etc ... ) into the structure itself, to allow the use of identical syntax all down the code. It makes it more readable, and shorter. And still, this is not C++, juste pure C.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-06-02 15:42 +0100 |
| Message-ID | <0.ad98122c5f4b9fe6aef5.20120602154227BST.87aa0lepws.fsf@bsb.me.uk> |
| In reply to | #21677 |
jgk@panix.com (Joe keane) writes:
> In article <slrnjscii7.2aju.willem@toad.stack.nl>,
> Willem <willem@toad.stack.nl> wrote:
>>I agree gotos are better.
>
> I agree gotos are better.
>
> int func(int x)
> {
> int err;
> struct bar *a;
> struct bar *b;
> struct bar *c;
> int err2;
>
> err = allocate_bar(&a);
> if (err != X_OK)
> goto done;
>
> err = allocate_bar(&b);
> if (err != X_OK)
> goto free_a;
>
> err = allocate_bar(&c);
> if (err != X_OK)
> goto free_b;
>
> ...
>
> /* normal exit */
>
> err = free_bar(c);
>
> err2 = free_bar(b);
> err = err != X_OK ? err : err2;
>
> err2 = free_bar(a);
> err = err != X_OK ? err : err2;
> return err;
>
> /* error exit */
>
> err2 = free_bar(c);
> (void) err2;
This code is unreachable but I think it's not needed by any path so it's
probably just there due to an editing error.
> free_b:
> err2 = free_bar(b);
> (void) err2;
>
> free_a:
> err2 = free_bar(a);
> (void) err2;
>
> done:
> return err;
> }
>
> do that in C++!
Why do you think this is not already C++?
BTW, to my mind this API is broken. I like allocation functions that
return NULL on failure. If you need more data, an error-collecting
parameter can be passed. Having NULL pointers make it possible to write
clean-up code that does not depend on the order of allocation.
However, using the same API, I'd write:
int func(int x)
{
int err_a, err_b, err_c;
struct bar *a, *b, *c;
err_a = allocate_bar(&a);
err_b = allocate_bar(&b);
err_c = allocate_bar(&c);
if (err_a == X_OK && err_b == X_OK && err_c == X_OK) {
/* normal code */
}
if (err_a == X_OK) err_a = free_bar(a);
if (err_b == X_OK) err_b = free_bar(b);
if (err_c == X_OK) err_c = free_bar(c);
return err_a == X_OK && err_b == X_OK && err_c == X_OK;
}
This does not return the same value, as your code but that's not hard to
change. I found your code's preference for one possible error over
another to be a little odd, so I changed it to appear more uniform.
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Date | 2012-06-02 19:35 +0000 |
| Message-ID | <jqdpuu$c5p$1@reader1.panix.com> |
| In reply to | #21688 |
In article <0.ad98122c5f4b9fe6aef5.20120602154227BST.87aa0lepws.fsf@bsb.me.uk>, Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >I like allocation functions that return NULL on failure. I like allocation functions that set the carry bit on failure. My own convention is that if a function returns less than zero, it has reset your state to the most extent possible, and none of the 'output' parameters are changed (but be liberal in what you receive). IMHE the stupid mistakes occur when you mix together conventions [it -should- be easy to do this, but we are just monkeys]. When you prevent stupid mistakes, you force people to make the more complicated mistakes.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-06-03 03:53 +0100 |
| Message-ID | <0.cea83dce1693b648297f.20120603035303BST.87y5o5cdio.fsf@bsb.me.uk> |
| In reply to | #21705 |
jgk@panix.com (Joe keane) writes: > In article <0.ad98122c5f4b9fe6aef5.20120602154227BST.87aa0lepws.fsf@bsb.me.uk>, > Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >>I like allocation functions that return NULL on failure. > > I like allocation functions that set the carry bit on failure. I wish you and the carry bit all the best. <snip> -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <thefatphil_demunged@yahoo.co.uk> |
|---|---|
| Date | 2012-06-11 18:10 +0300 |
| Message-ID | <8762axdgu5.fsf@bazspaz.fatphil.org> |
| In reply to | #21734 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes: > jgk@panix.com (Joe keane) writes: > > > In article <0.ad98122c5f4b9fe6aef5.20120602154227BST.87aa0lepws.fsf@bsb.me.uk>, > > Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: > >>I like allocation functions that return NULL on failure. > > > > I like allocation functions that set the carry bit on failure. > > I wish you and the carry bit all the best. What carry bit? I've searched high and low on my poor old Alpha, and can't find one. Phil -- > I'd argue that there is much evidence for the existence of a God. Pics or it didn't happen. -- Tom (/. uid 822)
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-06-11 16:19 +0100 |
| Message-ID | <0.596787c7ed5f50f7b014.20120611161933BST.87ipexx4e2.fsf@bsb.me.uk> |
| In reply to | #22115 |
Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes: > Ben Bacarisse <ben.usenet@bsb.me.uk> writes: >> jgk@panix.com (Joe keane) writes: >> >> > In article <0.ad98122c5f4b9fe6aef5.20120602154227BST.87aa0lepws.fsf@bsb.me.uk>, >> > Ben Bacarisse <ben.usenet@bsb.me.uk> wrote: >> >>I like allocation functions that return NULL on failure. >> > >> > I like allocation functions that set the carry bit on failure. >> >> I wish you and the carry bit all the best. > > What carry bit? I've searched high and low on my poor old Alpha, > and can't find one. Why are you asking me? -- Ben.
[toc] | [prev] | [next] | [standalone]
Page 1 of 7 [1] 2 3 4 5 6 7 Next page →
Back to top | Article view | comp.lang.c
csiph-web