Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | jgk@panix.com (Joe keane) |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Error returns and repeated code, GOTOs, etc. |
| Date | 2012-06-02 16:37 +0000 |
| Organization | Public Access Networks Corp. |
| Message-ID | <jqdfgn$o5b$1@reader1.panix.com> (permalink) |
| References | <7e54cf3c-d514-407b-a9b6-c0009589d242@ra8g2000pbc.googlegroups.com> <slrnjscii7.2aju.willem@toad.stack.nl> <jqd5ug$gt0$2@reader1.panix.com> <a77db563-a307-4c82-a32d-18fbc238afec@cu1g2000vbb.googlegroups.com> |
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.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web