Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Bartc <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Syntax error? |
| Date | 2015-04-26 11:36 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <mhif2c$mkd$1@dont-email.me> (permalink) |
| References | <mhg0mq$f25$1@dont-email.me> <mhiaif$7fj$1@news.albasani.net> <mhidu2$igd$1@dont-email.me> |
On 26/04/2015 11:17, Bartc wrote:
> On 26/04/2015 10:19, Johannes Bauer wrote:
>> On 25.04.2015 14:19, Bartc wrote:
>>> *(int (*))....
>> Is
>> there a reason why the code generate puts the "*" in braces for "int
>> (*)"?
> (AFAIK this doesn't affect the resulting code in any way.
Not completely true, as at least one compiler doesn't like this for example:
int (*fred(int a)) {
return 0;
}
But the same compiler is not going to like a lot of the C code I will
generate so I don't care!
Also, there is this example:
int *fred(int); // prototype for above
int *ptr; // pointer to int
If I add parentheses around the *name parts:
int (*fred)(int);
int (*ptr);
The int pointer is unaffected, but the first line now turns from a
function returning a pointer, to a pointer to a function! And therefore
the (int) following is an error. It is necessary to include the
parameter list within the parentheses.
--
Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Syntax error? Bartc <bc@freeuk.com> - 2015-04-25 13:19 +0100
Re: Syntax error? Richard Damon <Richard@Damon-Family.org> - 2015-04-25 11:07 -0400
Re: Syntax error? jacobnavia <jacob@jacob.remcomp.fr> - 2015-04-25 18:03 +0200
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-25 17:26 +0100
Re: Syntax error? jacobnavia <jacob@jacob.remcomp.fr> - 2015-04-25 19:28 +0200
Re: Syntax error? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-26 11:19 +0200
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 11:17 +0100
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 11:36 +0100
Re: Syntax error? Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-26 13:40 +0100
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 19:27 +0100
Re: Syntax error? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-26 12:38 -0700
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 22:26 +0100
Re: Syntax error? Keith Thompson <kst-u@mib.org> - 2015-04-26 12:41 -0700
Re: Syntax error? Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-27 01:53 +0100
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 13:24 +0100
Re: Syntax error? Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 07:01 -0700
Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 19:55 +0100
Re: Syntax error? Robert Wessel <robertwessel2@yahoo.com> - 2015-04-27 02:39 -0500
Re: Syntax error? Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:34 -0700
csiph-web