473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What is this - weird function definition

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
7 4737

"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
> 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
> > 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
"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
> > > 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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John | last post by:
Hi all; I write my first code using vector and list. When I run it, segmentation fault. Try to debug it, but it can not pass linking with -g option. What is the error with it? Thanks a lot....
51
by: jacob navia | last post by:
I would like to add at the beginning of the C tutorial I am writing a short blurb about what "types" are. I came up with the following text. Please can you comment? Did I miss something? Is...
15
by: Greenhorn | last post by:
Hi, when a function doesn't specify a return type ,value what value is returned. In the below programme, the function sample()is returning the value passed to 'k'. sample(int); main() { int...
13
by: William Ryan | last post by:
I just picked up a copy of John Robbins' debugging book and started to look at disassembled code. Anyway, I hate optional Parameters in VB, but I was checking them out to see what IL is created. ...
0
by: Zwyatt | last post by:
having a really weird little bug w/ time_t...check it out: I have the following code (simplified here): #include <time.h> class A { public: char *aString; int aNum;
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
14
by: WStoreyII | last post by:
the following code is supposed to read a whole line upto a new line char from a file. however it does not work. it is producing weird results. please help. I had error checking in there for...
3
by: Ronald S. Cook | last post by:
Thanks for reading this. I've successfully implemented a WCF solution. However, even though I designate the return type to be DataTable in my class on the server (hosted under IIS), it comes...
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.