Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: compiler switch to indicate "end of function"? |
| Date | 2011-05-10 17:34 -0700 |
| Organization | None to speak of |
| Message-ID | <lnaaeum5x3.fsf@nuthaus.mib.org> (permalink) |
| References | <e3632e70-5adf-4f04-807a-30634a5fc405@s41g2000prb.googlegroups.com> <78ab67fd-3a5e-49f2-8179-9501f22cbe26@n10g2000yqf.googlegroups.com> |
"Kleuskes & Moos" <kleuske@xs4all.nl> writes:
> On May 10, 6:00 pm, David Mathog <dmat...@gmail.com> wrote:
>> Sometimes when editing a source file a close brace is accidentally
>> deleted, and when that happens, at least with gcc, the error messages
>> are not very helpful in locating the error. Error messages are
>> generated from code below it, although not necessarily very near to
>> it, going on sometimes to the end of the file, thousands of lines
>> later. These errors can propagate through dozens of functions. Which
>> makes me wonder if there is something in the standard like:
>>
>> #endfunction
>>
>> to tell the compiler that if there is anything dangling in a function
>> at that point to throw an error there, and to start over cleanly below
>> the compiler directive. So that when
>>
>> void somefunc(void){
>> /* bunch of stuff, including one too few "}" */}
>>
>> #endfunction
>>
>> it will be clear from the messages that the problem is in somefunc().
>> In some instances I have had to emulate this by cutting off large
>> chunks of a file with
>>
>> #ifdef NOTDEFINED
>>
>> until the code is small enough to find the error.
>>
>> Thanks,
>>
>> David Mathog
>
> Ok. I;m sure i'll get the same flak as last time for supplying some
> good advice, but your coding style is the main culprit, i think.
> Instead of acknowledging the braces as the important structural
> elements they are, your treat them like bums and try to hide them, as
> if hey don't really matter.
>
> if instead of
>
>
> void somefunc(void){
> /* bunch of stuff, including one too few "}" */}
But that's not what he wrote. You put the closing brace at the end of a
line; he didn't.
What he actually wrote was:
BEGIN QUOTE
void somefunc(void){
/* bunch of stuff, including one too few "}" */
}
#endfunction
END QUOTE
My only quibble is that I'd put a space in front of the opening '{'.
[...]
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
compiler switch to indicate "end of function"? David Mathog <dmathog@gmail.com> - 2011-05-10 09:00 -0700
Re: compiler switch to indicate "end of function"? Tom St Denis <tom@iahu.ca> - 2011-05-10 10:08 -0700
Re: compiler switch to indicate "end of function"? Ben Pfaff <blp@cs.stanford.edu> - 2011-05-10 10:30 -0700
Re: compiler switch to indicate "end of function"? David Mathog <dmathog@gmail.com> - 2011-05-10 15:54 -0700
Re: compiler switch to indicate "end of function"? David Mathog <dmathog@gmail.com> - 2011-05-10 15:56 -0700
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-10 17:41 -0700
Re: compiler switch to indicate "end of function"? blp@cs.stanford.edu (Ben Pfaff) - 2011-05-10 21:07 -0700
Re: compiler switch to indicate "end of function"? Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-05-10 19:32 -0400
Re: compiler switch to indicate "end of function"? Michael Press <rubrum@pacbell.net> - 2011-05-10 23:32 -0700
Re: compiler switch to indicate "end of function"? Datesfat Chicks <datesfat.chicks@gmail.com> - 2011-05-11 11:49 -0400
Re: compiler switch to indicate "end of function"? Michael Press <rubrum@pacbell.net> - 2011-05-11 14:19 -0700
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-10 10:37 -0700
Re: compiler switch to indicate "end of function"? "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-10 13:34 -0700
Re: compiler switch to indicate "end of function"? Seebs <usenet-nospam@seebs.net> - 2011-05-10 21:22 +0000
Re: compiler switch to indicate "end of function"? "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-05-10 16:00 -0700
Re: compiler switch to indicate "end of function"? Seebs <usenet-nospam@seebs.net> - 2011-05-11 03:16 +0000
Re: compiler switch to indicate "end of function"? Ian Collins <ian-news@hotmail.com> - 2011-05-11 12:32 +1200
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-10 17:56 -0700
Re: compiler switch to indicate "end of function"? blp@cs.stanford.edu (Ben Pfaff) - 2011-05-10 21:09 -0700
Re: compiler switch to indicate "end of function"? Ian Collins <ian-news@hotmail.com> - 2011-05-11 16:14 +1200
Re: compiler switch to indicate "end of function"? Ben Pfaff <blp@cs.stanford.edu> - 2011-05-10 21:19 -0700
Re: compiler switch to indicate "end of function"? Ian Collins <ian-news@hotmail.com> - 2011-05-11 16:26 +1200
Re: compiler switch to indicate "end of function"? Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-11 07:10 +0100
Re: compiler switch to indicate "end of function"? Ian Collins <ian-news@hotmail.com> - 2011-05-11 20:50 +1200
Re: compiler switch to indicate "end of function"? Dr Nick <3-nospam@temporary-address.org.uk> - 2011-05-11 18:53 +0100
Re: compiler switch to indicate "end of function"? Sherm Pendley <sherm.pendley@gmail.com> - 2011-05-11 11:23 -0400
Re: compiler switch to indicate "end of function"? Seebs <usenet-nospam@seebs.net> - 2011-05-11 05:30 +0000
Re: compiler switch to indicate "end of function"? Jonathan Leffler <jleffler@earthlink.net> - 2011-05-10 21:26 -0700
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-11 08:07 -0700
Re: compiler switch to indicate "end of function"? luser- -droog <mijoryx@yahoo.com> - 2011-05-11 06:04 -0700
Re: compiler switch to indicate "end of function"? pete <pfiland@mindspring.com> - 2011-05-11 09:42 -0400
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-10 17:34 -0700
Re: compiler switch to indicate "end of function"? David Mathog <dmathog@gmail.com> - 2011-05-12 08:44 -0700
Re: compiler switch to indicate "end of function"? Kenneth Brody <kenbrody@spamcop.net> - 2011-05-12 13:41 -0400
Re: compiler switch to indicate "end of function"? Michael Press <rubrum@pacbell.net> - 2011-05-12 12:08 -0700
Re: compiler switch to indicate "end of function"? Chad <cdalten@gmail.com> - 2011-05-12 15:28 -0700
Re: compiler switch to indicate "end of function"? Keith Thompson <kst-u@mib.org> - 2011-05-12 11:49 -0700
Re: compiler switch to indicate "end of function"? David Mathog <dmathog@gmail.com> - 2011-05-13 08:56 -0700
Re: compiler switch to indicate "end of function"? "robertwessel2@yahoo.com" <robertwessel2@yahoo.com> - 2011-05-14 00:03 -0700
csiph-web