By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,906 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,906 IT Pros & Developers. It's quick & easy.

What is this - weird function definition

P: n/a
I found some code that seems a bit weird and is refusing to compile on
GCC...it apparently used to compile fine on other comilers.

typedef void ASY_TESTPROC_T __((OIDC_T lastmatch, int compc, OIDC_T *compl,
....));

There are several other ASY_XXXX defintion following, but AST_TESTPROC_T is
the first one.

There is macro: __(x) defined which basically does this
iifdef __STDC__
# define __(x) x
#else
#define __(x)

doing this, the output should be:

typedef void ASY_TESTPROC_T (OIDC_T lastmatch, int compc, OIDC_T *compl,
....);

But on the output of the preprocessor, I get
typedef void ASY_TESTPROC_T ((OIDC_T lastmatch, int compc, OIDC_T *compl,
....));

The other ASY_XXX appear to come out as expected.

First of all: am I understanding this code correctly. Is it a function
pointer declaration? From what I've read about the __() macro, it is
normally used for function prototypes. Secondly, anyone have any ideas why
it might not compile?

Yamin
Jul 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a

"Yamin" <ab*****@sdfdasfsd.com> wrote in message
news:Ig*******************@news20.bellglobal.com.. .
I found some code that seems a bit weird and is refusing to compile on
GCC...it apparently used to compile fine on other comilers.

typedef void ASY_TESTPROC_T __((OIDC_T lastmatch, int compc, OIDC_T *compl, ...));

[snip]

ARGHH!!.
I think I got an answer....
compl is a c++ keyword. That's prolly it. I'll verify it at work tomorrow.

Yamin
Jul 19 '05 #2

P: n/a
> I found some code that seems a bit weird and is refusing to compile on
GCC...it apparently used to compile fine on other comilers.

typedef void ASY_TESTPROC_T __((OIDC_T lastmatch, int compc, OIDC_T *compl, ...));

There are several other ASY_XXXX defintion following, but AST_TESTPROC_T is the first one.

There is macro: __(x) defined which basically does this
iifdef __STDC__
What is __STDC__? That is not C++.
# define __(x) x
#else
#define __(x)

doing this, the output should be:
Dunno, you don`t tell us if __STDC__ is defined or not.
First of all: am I understanding this code correctly. Is it a function
pointer declaration?
Not if ASY_TESTPROC_T is a name (would be a syntax error). If it is a
macro, show us what it is.
Secondly, anyone have any ideas why
it might not compile?


No, ask that in a newsgroup supporting your compiler. This is not standard
C++, as long as you don't give us standard code. Try to expand the macros
and try again.
Jonathan
Jul 19 '05 #3

P: n/a
> > I found some code that seems a bit weird and is refusing to compile on
GCC...it apparently used to compile fine on other comilers.

typedef void ASY_TESTPROC_T __((OIDC_T lastmatch, int compc, OIDC_T

*compl,
...));

[snip]

ARGHH!!.
I think I got an answer....
compl is a c++ keyword. That's prolly it. I'll verify it at work

tomorrow.

A c++ keyword? Is the new standard out? Damn.. nobody told me.
Jonathan
Jul 19 '05 #4

P: n/a
"Jonathan Mcdougall" <jo***************@DELyahoo.ca> wrote:
compl is a c++ keyword.
A c++ keyword? Is the new standard out? Damn.. nobody told me.


Indeed, 'compl' is a keyword: it is a synonym for '~', the bitwise
complement operator. ... and what do you mean my "new standard"?
There is so far only one C++ standard: ISO 14882 (1998). You might
want to check section 2.5. (lex.digraph), paragraph 2.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
Jul 19 '05 #5

P: n/a
> > > compl is a c++ keyword.
A c++ keyword? Is the new standard out? Damn.. nobody told me.
Indeed, 'compl' is a keyword: it is a synonym for '~', the bitwise
complement operator. ...


Wow, did not know that (sorry to the op).
and what do you mean my "new standard"?


A joke.
Jonathan
Jul 19 '05 #6

P: n/a
WW
Dietmar Kuehl wrote:
"Jonathan Mcdougall" <jo***************@DELyahoo.ca> wrote:
compl is a c++ keyword.

A c++ keyword? Is the new standard out? Damn.. nobody told me.


Indeed, 'compl' is a keyword: it is a synonym for '~', the bitwise
complement operator.


It is *not* a keyword. It is an alternative token.
--
WW aka Attila
Jul 19 '05 #7

P: n/a

"Jonathan Mcdougall" <jo***************@DELyahoo.ca> wrote in message
news:MN********************@wagner.videotron.net.. .
> compl is a c++ keyword.

A c++ keyword? Is the new standard out? Damn.. nobody told me.


Indeed, 'compl' is a keyword: it is a synonym for '~', the bitwise
complement operator. ...


Wow, did not know that (sorry to the op).
and what do you mean my "new standard"?


A joke.
Jonathan


I got ur joke...aka...sarcasm :) Sometimes, only sometimes...maybe 0.1% of
the time slamming someone with the C++ standard is not the correct response
in this group.

Yeah, the compl is a reserved name (as keyword is apparently wrong
terminology).
It took me by surprise. I only managed to find it by browsing around
looking for that macro and luckily clicked on a link which gave a list of
all the reserved names. It took my interest, and boom...there it was.

It's just really weird how watcom and green hills both accepted it. Guess
they could figure it out that the code meant compl as an identifier and the
reserved word. Or maybe they don't even reserve compl. Now that would be
implementation specific :)
Yamin
Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.