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

How do I create a function in my library for passing user callback function

P: n/a
Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}

Then called like this:
clientfunction(sz); // sz is a C-string.

But program crashes with access violation when attempt to call
clientfunction

What am I doing wrong?
Jun 27 '08 #1
Share this Question
Share on Google+
40 Replies


P: n/a
Angus wrote:
Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}

Then called like this:
clientfunction(sz); // sz is a C-string.
You should be passing the address of the function, not a string.

int f( const char* );

clientfunction( f );

--
Ian Collins.
Jun 27 '08 #2

P: n/a
Ian Collins said:
Angus wrote:
>Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}

Then called like this:
clientfunction(sz); // sz is a C-string.
You should be passing the address of the function, not a string.

int f( const char* );

clientfunction( f );
I doubt it. Since clientfunction is an instance of callbackfunction (and
presumably the definition of callbackfunction, above, is supposed to be a
typedef), it takes a const char *, not an int(*)(const char *).
>
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #3

P: n/a
Richard Heathfield wrote:
Ian Collins said:
>Angus wrote:
>>Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}

Then called like this:
clientfunction(sz); // sz is a C-string.
You should be passing the address of the function, not a string.

int f( const char* );

clientfunction( f );

I doubt it. Since clientfunction is an instance of callbackfunction (and
presumably the definition of callbackfunction, above, is supposed to be a
typedef), it takes a const char *, not an int(*)(const char *).
OK, I promise never to post pre-caffeine ever again!

I read the OP as passing a string to SpecifyCallbackfunction.

--
Ian Collins.
Jun 27 '08 #4

P: n/a
"Angus" <no****@gmail.comwrites:
I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;
This won't compile. I suspect you have a typedef that you are not
showing us!

<snip>
But program crashes with access violation when attempt to call
clientfunction

What am I doing wrong?
Try to post a short, compilable, example of the problem. The outline
you posted is sound, the error is in the detail (and is somewhere
else).

--
Ben.
Jun 27 '08 #5

P: n/a

Angus <no****@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;
}

Then called like this:
clientfunction(sz); // sz is a C-string.

But program crashes with access violation when attempt to call
clientfunction

What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:

In the header file for your library, declare the function as follows:

extern void my_library_function(int (*)(const char*));

(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)

Now write your library function that takes the callback as
a parameter in the source file for your library:

void my_library_function(int my_callback_function(const char*)) {
int my_callback_return;
char *my_string;

... /* generic stuff done here, probably "build up" my_string */

my_callback_return=my_callback_function(my_string) ;

... /* more generic stuff maybe, maybe check my_callback_return */
}

Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:

int my_specific_function(const char* my_string) {

... /* do something with string, probably print it, right? */
}

Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have defined
that match the callback signature:

void my_function(void) {

... /* stuff happens here, whatever, maybe nothing, who knows */

my_library_function(my_specific_function);

... /* and whatever else */
}

And that's "all" there is to it...not that bad once you get the hang of
it, just follow the pattern above, sometimes you have to really "think"
about what the perfect "signature" will be for all the various callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...

---
William Ernest Reid

Jun 27 '08 #6

P: n/a
Bill Reid said:
Angus <no****@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
<snip>
>>
What am I doing wrong?

Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
When you make a claim like that, you should back it up with working code.
You didn't. A conforming implementation *must* diagnose, and *may* refuse
to translate, your code.

Your track record of ignoring or even railing against those who notify you
of your mistakes gives me little or no hope that you'll pay any attention
to this, but the OP will at least have fair warning of the kind of
"competence" to which you are exposing him.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #7

P: n/a

Richard Heathfield <rj*@see.sig.invalidwrote in message
news:a9*********************@bt.com...
Bill Reid said:
Angus <no****@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
<snip>
>
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:

When you make a claim like that, you should back it up with working code.
You didn't. A conforming implementation *must* diagnose, and *may* refuse
to translate, your code.
Well, I didn't really write any code, you insane troll, so I guess
you're "right" again, as always...
Your track record of ignoring or even railing against those who notify you
of your mistakes gives me little or no hope that you'll pay any attention
to this, but the OP will at least have fair warning of the kind of
"competence" to which you are exposing him.
Well, no, I couldn't help but notice that you didn't specify any
actual problems with what I posted, so how would he know what's
wrong with it? Believe me, for his sake, you should let HIM know,
and let ALL of us know, including me, so we can all benefit from
your tremendous "wisdom"...I'd be the first to admit that I make
a LOT of mistakes, have made many here, and there may be
errors or omissions in my post, and I'd genuinely like to be
"set straight", but somehow I think you're just blowin' troll
smoke again, as usual...

So if you got anything of substance, post it; I'm not saying it
would be a first, but along the lines of a rarity...

---
William Ernest Reid

Jun 27 '08 #8

P: n/a
Bill Reid said:
>
Richard Heathfield <rj*@see.sig.invalidwrote in message
news:a9*********************@bt.com...
>Bill Reid said:
Angus <no****@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
<snip>
>>
What am I doing wrong?

Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:

When you make a claim like that, you should back it up with working
code. You didn't. A conforming implementation *must* diagnose, and *may*
refuse to translate, your code.

Well, I didn't really write any code, you insane troll, so I guess
you're "right" again, as always...
Here is the code you claim you didn't really write, which I've copied
verbatim from your article.

extern void my_library_function(int (*)(const char*));
void my_library_function(int my_callback_function(const char*)) {
int my_callback_return;
char *my_string;

... /* generic stuff done here, probably "build up" my_string */

my_callback_return=my_callback_function(my_string) ;

... /* more generic stuff maybe, maybe check my_callback_return */
}
int my_specific_function(const char* my_string) {

... /* do something with string, probably print it, right? */
}
void my_function(void) {

... /* stuff happens here, whatever, maybe nothing, who knows */

my_library_function(my_specific_function);

... /* and whatever else */
}

Note that my observation about failure to compile does not relate to
obvious "more stuff goes here" conventions such as an occasional ellipsis.
>Your track record of ignoring or even railing against those who notify
you of your mistakes gives me little or no hope that you'll pay any
attention to this, but the OP will at least have fair warning of the
kind of "competence" to which you are exposing him.

Well, no, I couldn't help but notice that you didn't specify any
actual problems with what I posted,
No point. You never listen anyway.
so how would he know what's wrong with it?
Since it doesn't compile, he'll find out pretty quickly that it *is* wrong.
As to *why* it's wrong, that's easy. It was written by someone who doesn't
understand C very well.
So if you got anything of substance, post it;
After you.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #9

P: n/a
On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined callback
function. *The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? *How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)
what is cbFunction?
{
* *clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); *// sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?

Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
before making remarks like that you should make *really*
sure you havn't made any foolish errors in your code...

Oh, sorry I forgot you didn't post any code!
In the header file for your library, declare the function as follows:

extern void my_library_function(int (*)(const char*));

(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)
a substantial body of people don't, so consider missing it out.
Now write your library function that takes the callback as
a parameter in the source file for your library:

void my_library_function(int my_callback_function(const char*)) {
* * int my_callback_return;
* * char *my_string;

* * ... /* generic stuff done here, probably "build up" my_string **/

* * my_callback_return=my_callback_function(my_string) ;

* * ... /* more generic stuff maybe, maybe check my_callback_return **/
* * }

Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:

int my_specific_function(const char* my_string) {

* * ... /* do something with string, probably print it, right? **/
* * }

Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have defined
that match the callback signature:

void my_function(void) {

* * ... /* stuff happens here, whatever, maybe nothing, who knows **/

* * my_library_function(my_specific_function);

* * ... /* and whatever else **/
* * }

And that's "all" there is to it...not that bad once you get the hang of
it, just follow the pattern above,
no! don't follow the pattern above!
sometimes you have to really "think"
about what the perfect "signature" will be for all the various callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...
no not at all.

Ok. Here's a more compact form of your code with a driver added.
/***********/
/* the code that Bill Reid didn't write */

extern void my_library_function (int (*)(const char*));

void my_library_function(int my_callback_function(const char*)) /*
<--- error */
{
int my_callback_return;
char *my_string = "";
my_callback_return=my_callback_function (my_string);
}

int my_specific_function (const char* my_string)
{
return 0;
}

/* driver added by me */
int main (void)
{
my_library_function (my_specific_function);
return 0;
}
/**********/

and my compiler does this

Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration

So let's try this pattern:-

/* in the header */
typedef int (*Callback)(const char*);
void my_library_function (Callback);
/* in the library */
void my_library_function (Callback my_callback_function)
{
int my_callback_return;
char *my_string = "";
my_callback_return = my_callback_function (my_string);
}
/* in the caller's code */
int my_specific_function (const char* my_string)
{
return 0;
}

/* driver added by me */
int main (void)
{
my_library_function (my_specific_function);
return 0;
}
the typedef makes life *much* easier.

So how to construct the typedef?

Suppose the callback is going to look something like this
int f1 (int x)

put a typedef in front of it and change the name
to your convention for types (I start a typename
with an uppercase letter)
typedef int F1 (int x);

put a * in front of the function name and bracket the name
and the *.
typedef int (*F1) (int x);

remove the argument names if you like.
typedef int (*F1) (int);

You can then use this wherever you need the function
pointer.

A slightly more complicated example
char *f2 (int x, double x, F1 callback);
typedef char* (*F2) (int, double, F1);

You even return function pointers
F1 setCB (F1 new_call);
typedef F1 (*SetCB) (F1);
Some people prefer to typedef the function then the
pointerness is not hidden.

typedef int F1 (int);
typedef char* F2 (int, double, F1*);

And now I'm guilty of Reid's syndrome, I havn't
compiled this. But I did compile the pattern
I recommend (and use).
--
Nick Keighley

As I recall, OSI dealt with TCP/IP by just admitting it into the spec
as a variation of existing levels. This is akin to dealing with an
Alien face hugger by allowing it to implant its embryo in your body.
Jun 27 '08 #10

P: n/a
On 14 Apr, 08:10, Richard Heathfield <r...@see.sig.invalidwrote:
Bill Reid said:
Richard Heathfield <r...@see.sig.invalidwrote in message
news:a9*********************@bt.com...
Bill Reid said:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
oh the irony...
When you make a claim like that, you should back it up with working
code. You didn't. A conforming implementation *must* diagnose, and *may*
refuse to translate, your code.
Well, I didn't really write any code, you insane troll, so I guess
you're "right" again, as always...

Here is the code you claim you didn't really write, which I've copied
verbatim from your article.
<snip code-like stuff>
Note that my observation about failure to compile does not relate to
obvious "more stuff goes here" conventions such as an occasional ellipsis.
Your track record of ignoring or even railing against those who notify
you of your mistakes gives me little or no hope that you'll pay any
attention to this, but the OP will at least have fair warning of the
kind of "competence" to which you are exposing him.
Well, no, I couldn't help but notice that you didn't specify any
actual problems with what I posted,

No point. You never listen anyway.
so how would he know what's wrong with it?

Since it doesn't compile, he'll find out pretty quickly that it *is* wrong.
As to *why* it's wrong, that's easy. It was written by someone who doesn't
understand C very well.
So if you got anything of substance, post it;

After you.
perhaps, Richard, if you tried to be just a little less gnomic...
Perhaps, even, point out the error :-)

Who remembers the Campaign Againt Grumpiness in c.l.c.?
--
Nick Keighley

If cosmology reveals anything about God, it is that He has
an inordinate fondness for empty space and non-baryonic dark
matter.
Sverker Johansson (talk.origins)
Jun 27 '08 #11

P: n/a
Nick Keighley said:

<snip>
perhaps, Richard, if you tried to be just a little less gnomic...
Tried that before. It don't work, with Mr Reid.
Perhaps, even, point out the error :-)
You already done that.
Who remembers the Campaign Againt Grumpiness in c.l.c.?
It was the Campaign Against *Excessive* Grumpiness, IIRC.

And who remembers the Campaign for Grumpiness where Grumpiness is Due?

Given Mr Reid's track record, I don't think I'm flouting the membership
rules of either of those campaigns.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #12

P: n/a
On Apr 14, 3:49 am, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)

what is cbFunction?
{
clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); // sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:

before making remarks like that you should make *really*
sure you havn't made any foolish errors in your code...

Oh, sorry I forgot you didn't post any code!
In the header file for your library, declare the function as follows:
extern void my_library_function(int (*)(const char*));
(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)

a substantial body of people don't, so consider missing it out.
Now write your library function that takes the callback as
a parameter in the source file for your library:
void my_library_function(int my_callback_function(const char*)) {
int my_callback_return;
char *my_string;
... /* generic stuff done here, probably "build up" my_string */
my_callback_return=my_callback_function(my_string) ;
... /* more generic stuff maybe, maybe check my_callback_return */
}
Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:
int my_specific_function(const char* my_string) {
... /* do something with string, probably print it, right? */
}
Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have defined
that match the callback signature:
void my_function(void) {
... /* stuff happens here, whatever, maybe nothing, who knows */
my_library_function(my_specific_function);
... /* and whatever else */
}
And that's "all" there is to it...not that bad once you get the hang of
it, just follow the pattern above,

no! don't follow the pattern above!
sometimes you have to really "think"
about what the perfect "signature" will be for all the various callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...

no not at all.

Ok. Here's a more compact form of your code with a driver added.

/***********/
/* the code that Bill Reid didn't write */

extern void my_library_function (int (*)(const char*));

void my_library_function(int my_callback_function(const char*)) /*
<--- error */
{
int my_callback_return;
char *my_string = "";
my_callback_return=my_callback_function (my_string);

}

int my_specific_function (const char* my_string)
{
return 0;

}

/* driver added by me */
int main (void)
{
my_library_function (my_specific_function);
return 0;}

/**********/

and my compiler does this

Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration
Is it the error you mentioned? What does it warn about?
Parameter is declared as a function, that's adjusted to
the pointer to a function. What exactly is wrong?

Yevgen
Jun 27 '08 #13

P: n/a
"Bill Reid" <ho********@happyhealthy.netwrites:
Angus <no****@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
>>
I am writing a library which will write data to a user defined callback
function.
<snip>
>But program crashes with access violation when attempt to call
clientfunction

What am I doing wrong?

Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
Posting incorrect syntax won't help the OP. In fact, there is some
evidence that the OP knows the correct syntax for what they are doing
since the problem they report is a run time one. Only an example of
their actual code will help diagnose what they are doing wrong.

--
Ben.
Jun 27 '08 #14

P: n/a
On 14 Apr, 10:34, ymunt...@gmail.com wrote:
On Apr 14, 3:49 am,Nick Keighley<nick_keighley_nos...@hotmail.com>
wrote:


On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
>news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined callback
function. *The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? *How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)
what is cbFunction?
{
* *clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); *// sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
before making remarks like that you should make *really*
sure you havn't made any foolish errors in your code...
Oh, sorry I forgot you didn't post any code!
In the header file for your library, declare the function as follows:
extern void my_library_function(int (*)(const char*));
(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)
a substantial body of people don't, so consider missing it out.
Now write your library function that takes the callback as
a parameter in the source file for your library:
void my_library_function(int my_callback_function(const char*)) {
* * int my_callback_return;
* * char *my_string;
* * ... /* generic stuff done here, probably "build up" my_string **/
* * my_callback_return=my_callback_function(my_string) ;
* * ... /* more generic stuff maybe, maybe check my_callback_return **/
* * }
Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:
int my_specific_function(const char* my_string) {
* * ... /* do something with string, probably print it, right? **/
* * }
Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have defined
that match the callback signature:
void my_function(void) {
* * ... /* stuff happens here, whatever, maybe nothing, who knows **/
* * my_library_function(my_specific_function);
* * ... /* and whatever else **/
* * }
And that's "all" there is to it...not that bad once you get the hang of
it, just follow the pattern above,
no! don't follow the pattern above!
sometimes you have to really "think"
about what the perfect "signature" will be for all the various callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...
no not at all.
Ok. Here's a more compact form of your code with a driver added.
/***********/
/* the code that Bill Reid didn't write */
extern void my_library_function (int (*)(const char*));
void my_library_function(int my_callback_function(const char*)) */*
<--- error */
{
* * int my_callback_return;
* * char *my_string = "";
* * my_callback_return=my_callback_function (my_string);
}
int my_specific_function (const char* my_string)
{
* * return 0;
}
/* driver added by me */
int main (void)
{
* * my_library_function (my_specific_function);
* * return 0;}
/**********/
and my compiler does this
Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration

Is it the error you mentioned?
is *what* the error I mentioned? The error above occurs on
the line I indicated.

What does it warn about?
I have this trouble when people ask me to explain syntax errors.
To me (maybe I've been at this too long) they seem self explanatory
(maybe one day I'll say the same about a three page C++
template diagnostic (but not yet)).

Well it warns that the formal parameters does not
match the declaration. It even tells you which parameter (paramter 1).
Which
is nice of it but not very helpful as it only has one parameter.

The formal parameter appears in the definition
void my_library_function(int my_callback_function(const char*))

so the formal parameter is
int my_callback_function(const char*))

which is a function. This doesn't make much sense to me.
I'm surprised the compiler didn't get more upset.

The declaration is:
extern void my_library_function (int (*)(const char*));

so the parameter is
int (*)(const char*)

Formal is a ptr-to-function-taking-const-char*-and-returning-int

So what parameter is a function declaration and the other
is a function pointer. They don't match.

Parameter is declared as a function, that's adjusted to
the pointer to a function. What exactly is wrong?
is it?
--
Nick Keighley
Jun 27 '08 #15

P: n/a

Wouldn't you know it, this tool posts from Google(TM) Groups...

HEY, FOOL, IF YOU'RE GONNA BE SUCH AN IDIOT AS TO
POST FROM THE SCOURGE OF USENET, AT LEAST LEARN
HOW TO DO IT SO YOUR POSTS ARE QUOTED PROPERLY!!!

TIA!!! (but really, not holding my breath waiting for him to learn
how to post to Usenet...that's too "technical")

Nick Keighley <ni******************@hotmail.comwrote in message
news:ef**********************************@m73g2000 hsh.googlegroups.com...
On 14 Apr, 10:34, ymunt...@gmail.com wrote:
On Apr 14, 3:49 am,Nick Keighley<nick_keighley_nos...@hotmail.com>
wrote:
On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
>news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined
callback
function. The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)
what is cbFunction?
{
clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); // sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
before making remarks like that you should make *really*
sure you havn't made any foolish errors in your code...
PKB. But let's see how this develops...just don't get all pissy
if it doesn't work out the way you want, like "Little Dick" AKA
"troll zero"...remember, we're allegedly trying to "help" a confused
person here, but to do that, we have to "help" each other, right?
Oh, sorry I forgot you didn't post any code!
I'll correct that "error" now...
In the header file for your library, declare the function as follows:
extern void my_library_function(int (*)(const char*));
(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)
a substantial body of people don't, so consider missing it out.
Maybe it's a mistake to NOT include it...I know this is hard,
but THINK...
Now write your library function that takes the callback as
a parameter in the source file for your library:
void my_library_function(int my_callback_function(const char*)) {
int my_callback_return;
char *my_string;
... /* generic stuff done here, probably "build up" my_string */
my_callback_return=my_callback_function(my_string) ;
... /* more generic stuff maybe, maybe check my_callback_return */
}
Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:
int my_specific_function(const char* my_string) {
... /* do something with string, probably print it, right? */
}
Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have
defined
that match the callback signature:
void my_function(void) {
... /* stuff happens here, whatever, maybe nothing, who knows */
my_library_function(my_specific_function);
... /* and whatever else */
}
And that's "all" there is to it...not that bad once you get the hang
of
it, just follow the pattern above,
no! don't follow the pattern above!
Why not? Works for me...what's the disconnect?
sometimes you have to really "think"
about what the perfect "signature" will be for all the various
callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...
no not at all.
OK, you're right, you don't have to THINK about anything at all
when programming...oh, that's right, you DO have to think when
programming, just not when posting to the Internet...
Ok. Here's a more compact form of your code with a driver added.
/***********/
/* the code that Bill Reid didn't write */
extern void my_library_function (int (*)(const char*));
void my_library_function(int my_callback_function(const char*)) /*
<--- error */
{
int my_callback_return;
char *my_string = "";
my_callback_return=my_callback_function (my_string);
}
int my_specific_function (const char* my_string)
{
return 0;
}
/* driver added by me */
int main (void)
{
my_library_function (my_specific_function);
return 0;}
/**********/
and my compiler does this
Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration

Is it the error you mentioned?
--- unquoted tool text ---
is *what* the error I mentioned? The error above occurs on
the line I indicated.
--- end tool text

He's asking you why your compiler reports an error, since his
may not under the same circumstances, you massive tool...
What does it warn about?
--- unquoted tool text ---
I have this trouble when people ask me to explain syntax errors.
To me (maybe I've been at this too long) they seem self explanatory
(maybe one day I'll say the same about a three page C++
template diagnostic (but not yet)).
--- end tool text

IBID (what a total tool this idiot is..)

--- unquoted tool text ---
Well it warns that the formal parameters does not
match the declaration. It even tells you which parameter (paramter 1).
Which
is nice of it but not very helpful as it only has one parameter.

The formal parameter appears in the definition
void my_library_function(int my_callback_function(const char*))

so the formal parameter is
int my_callback_function(const char*))

which is a function. This doesn't make much sense to me.
I'm surprised the compiler didn't get more upset.

The declaration is:
extern void my_library_function (int (*)(const char*));

so the parameter is
int (*)(const char*)

Formal is a ptr-to-function-taking-const-char*-and-returning-int

So what parameter is a function declaration and the other
is a function pointer. They don't match.
--- end tool text
Parameter is declared as a function, that's adjusted to
the pointer to a function. What exactly is wrong?
--- unquoted tool text ---
is it?
-- end tool text

Yes, you total tool, that's his conception about how function
pointers work, and basically mine...so here's my REALLY
compact version of the code THAT COMPILES COMPLETELY
CLEANLY FOR ME:

library_h.h

/* library_h.h */
/* library header file */

extern void my_library_function (int (*)(const char*));

library_c.c

/* library_c.c */
/* library "C" source */

#include "library_h.h"

void my_library_function(int my_callback_function(const char*)) {

}

I can compile library_c.c to library_c.obj without so much as
a warning, error, scolding, and then proceed likewise to build
library.lib...so in the interest of everybody learning something
today, other than you're a tool who doesn't know how to post
to Usenet, EXPLAIN THE DISCREPANCY..."spec lawyer" it,
tell us exactly what you did differently, whatever, just clear up
the confusion here...

---
William Ernest Reid

Jun 27 '08 #16

P: n/a
On Apr 14, 6:50 am, Nick Keighley <nick_keighley_nos...@hotmail.com>
wrote:
On 14 Apr, 10:34, ymunt...@gmail.com wrote:
On Apr 14, 3:49 am,Nick Keighley<nick_keighley_nos...@hotmail.com>
wrote:
On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:
int (*callbackfunction)(const char*);
In my libary do I create a function where user passes this callback
function? How would I define the function?
I tried this
callbackfunction clientfunction;
void SpecifyCallbackfunction(cbFunction cbFn)
what is cbFunction?
{
clientfunction = cbFn;
}
Then called like this:
clientfunction(sz); // sz is a C-string.
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:
before making remarks like that you should make *really*
sure you havn't made any foolish errors in your code...
Oh, sorry I forgot you didn't post any code!
In the header file for your library, declare the function as follows:
extern void my_library_function(int (*)(const char*));
(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)
a substantial body of people don't, so consider missing it out.
Now write your library function that takes the callback as
a parameter in the source file for your library:
void my_library_function(int my_callback_function(const char*)) {
int my_callback_return;
char *my_string;
... /* generic stuff done here, probably "build up" my_string */
my_callback_return=my_callback_function(my_string) ;
... /* more generic stuff maybe, maybe check my_callback_return */
}
Now, for any source file that you want to use that generic
my_library_function(), you can call it by first #include'ing the
library header file, then defining a specific callback function that
matches the declaration in the header file:
int my_specific_function(const char* my_string) {
... /* do something with string, probably print it, right? */
}
Then you can call your library function with the callback anywhere
in your source file, as well as any other functions that you have defined
that match the callback signature:
void my_function(void) {
... /* stuff happens here, whatever, maybe nothing, who knows */
my_library_function(my_specific_function);
... /* and whatever else */
}
And that's "all" there is to it...not that bad once you get the hang of
it, just follow the pattern above,
no! don't follow the pattern above!
sometimes you have to really "think"
about what the perfect "signature" will be for all the various callbacks
you want for a generic library function, what all data you need to
pass for all possible conditions...
no not at all.
Ok. Here's a more compact form of your code with a driver added.
/***********/
/* the code that Bill Reid didn't write */
extern void my_library_function (int (*)(const char*));
void my_library_function(int my_callback_function(const char*)) /*
<--- error */
{
int my_callback_return;
char *my_string = "";
my_callback_return=my_callback_function (my_string);
}
int my_specific_function (const char* my_string)
{
return 0;
}
/* driver added by me */
int main (void)
{
my_library_function (my_specific_function);
return 0;}
/**********/
and my compiler does this
Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration
Is it the error you mentioned?

is *what* the error I mentioned? The error above occurs on
the line I indicated.
What does it warn about?

I have this trouble when people ask me to explain syntax errors.
There isn't a syntax error (and your compiler agrees). If
you think a warning message is obviously "a syntax error",
then you're wrong.
To me (maybe I've been at this too long) they seem self explanatory
(maybe one day I'll say the same about a three page C++
template diagnostic (but not yet)).

Well it warns that the formal parameters does not
match the declaration. It even tells you which parameter (paramter 1).
Which
is nice of it but not very helpful as it only has one parameter.

The formal parameter appears in the definition
void my_library_function(int my_callback_function(const char*))

so the formal parameter is
int my_callback_function(const char*))

which is a function. This doesn't make much sense to me.
I'm surprised the compiler didn't get more upset.
It makes perfect sense, just like array parameters:
int a[] gets transformed ("adjusted" in standardese) to
int *a. See 6.7.5.3p8.

Does your compiler warn about this:

int func (int *a);
int func (int a[]);

Yevgen
Jun 27 '08 #17

P: n/a
On Apr 14, 4:47 am, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
"Bill Reid" <hormelf...@happyhealthy.netwrites:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
I am writing a library which will write data to a user defined callback
function.
<snip>
But program crashes with access violation when attempt to call
clientfunction
What am I doing wrong?
Well, just about everything, and most pertinently, asking a question
here, the land of the technically-incompetent trolls...but here's how
you do it:

Posting incorrect syntax won't help the OP. In fact, there is some
evidence that the OP knows the correct syntax for what they are doing
since the problem they report is a run time one. Only an example of
their actual code will help diagnose what they are doing wrong.
Perhaps you can tell what exactly was wrong? Richard Heathfield
refused to, Nick Keighley somehow made a syntax error of a
compiler warning, so maybe you can explain what this fuzz is
about? (Except Bill Reid being a troll, of course, which is
obvious and doesn't require any syntax errors or whatever
to be proved)

Yevgen
Jun 27 '08 #18

P: n/a
ym******@gmail.com said:

<snip>
Perhaps you can tell what exactly was wrong? Richard Heathfield
refused to,
Nick Keighley has already done so; I don't really see the point in
duplicating that.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #19

P: n/a
On Apr 14, 1:08 pm, Richard Heathfield <r...@see.sig.invalidwrote:
ymunt...@gmail.com said:

<snip>
Perhaps you can tell what exactly was wrong? Richard Heathfield
refused to,

Nick Keighley has already done so; I don't really see the point in
duplicating that.
I see. Nothing was wrong then?

Yevgen
Jun 27 '08 #20

P: n/a
ym******@gmail.com said:
On Apr 14, 1:08 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>ymunt...@gmail.com said:

<snip>
Perhaps you can tell what exactly was wrong? Richard Heathfield
refused to,

Nick Keighley has already done so; I don't really see the point in
duplicating that.

I see. Nothing was wrong then?
You appear to have misunderstood.

The code posted by Bill Reid contained a bug.

Nick Keighley pointed out the bug.

If bugs aren't wrong, then nothing was wrong.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #21

P: n/a
"Bill Reid" <ho********@happyhealthy.netwrites:
<snip lots>

Why do you have to be so angry? There is a technical matter here so I
will get stuck in, but I am wary of getting caught in the middle of a
flame war.
... that's his conception about how function
pointers work, and basically mine...so here's my REALLY
compact version of the code THAT COMPILES COMPLETELY
CLEANLY FOR ME:

library_h.h

extern void my_library_function (int (*)(const char*));

library_c.c

#include "library_h.h"

void my_library_function(int my_callback_function(const char*)) {
}
You must be aware that is this not the normal syntax. Usually, the
function definition is similar to the declaration, except the ';' is
replaced by the function body. Here, you have an odd-looking
parameter. Function pointer parameters usually look like this:

void my_library_function(int (*my_callback_function)(const char*)) {}

which is, of course, how you wrote it in the function's prototype.
This example *seems* to declare the parameter as a function, not a
pointer to one.
I can compile library_c.c to library_c.obj without so much as
a warning, error, scolding, and then proceed likewise to build
library.lib...so in the interest of everybody learning something
today, other than you're a tool who doesn't know how to post
to Usenet, EXPLAIN THE DISCREPANCY..."spec lawyer" it,
tell us exactly what you did differently, whatever, just clear up
the confusion here...
The answer is that there is a special dispensation:

A declaration of a parameter as ‘‘function returning type’’ shall be
adjusted to ‘‘pointer to function returning type’’

This is the same sort of special case that makes 'int x[]' be treated
as a pointer rather than an (un-passable) array. Your example is less
than clear for people learning the language or having trouble with
function pointers. I would not post it as an example to follow, but
it is correct.

--
Ben.
Jun 27 '08 #22

P: n/a
On Apr 13, 12:39 pm, "Angus" <nos...@gmail.comwrote:
Hello

I am writing a library which will write data to a user defined callback
function. The function the user of my library will supply is:

int (*callbackfunction)(const char*);

In my libary do I create a function where user passes this callback
function? How would I define the function?

I tried this

callbackfunction clientfunction;

void SpecifyCallbackfunction(cbFunction cbFn)
{
clientfunction = cbFn;

}

Then called like this:
clientfunction(sz); // sz is a C-string.

But program crashes with access violation when attempt to call
clientfunction

What am I doing wrong?
Based on what you've written here, it sounds like you want to
"register" the callback so it can be called by other functions within
the library: is that correct? If so, here's one approach:

/* Library header file */
#ifndef LIB_H
#define LIB_H
/**
* Create a typedef for the function pointer type
*/
typedef int (*callback)(const char *);

/**
* Register the callback function
*/
void SpecifyCallbackfunction(callback f);

/**
* Other library functions that will use the callback
*/
void L1(const char *foo);
void L2(void);

#endif

/**
* Library implementation file
*/

/**
* File-scope global for callback
*/
static callback g_callback;

void SpecifyCallbackFunction(callback f)
{
g_callback = f;
}

void L1(const char *foo)
{
int bar = g_callback(foo);
...
}

void L2(void)
{
int bar = g_callback("DUMMY");
...
}

/**
* main
*/

#include "library.h"

int blah(const char *bletch)
{
int retVal;
retVal = /* result of doing something with bletch */
return retVal;
}

int main(void)
{
SpecifyCallbackFunction(blah);
L1("blurga");
L2();
...
return 0;
}

HTH.
Jun 27 '08 #23

P: n/a
On Apr 14, 3:03 pm, Richard Heathfield <r...@see.sig.invalidwrote:
ymunt...@gmail.com said:
On Apr 14, 1:08 pm, Richard Heathfield <r...@see.sig.invalidwrote:
ymunt...@gmail.com said:
<snip>
Perhaps you can tell what exactly was wrong? Richard Heathfield
refused to,
Nick Keighley has already done so; I don't really see the point in
duplicating that.
I see. Nothing was wrong then?

You appear to have misunderstood.

The code posted by Bill Reid contained a bug.

Nick Keighley pointed out the bug.
No he didn't. He did talk about the warning produced
by his compiler, and called that warning "syntax error".
Now, there wasn't a syntax error. So, what's the bug?

Yevgen
Jun 27 '08 #24

P: n/a
ym******@gmail.com writes:
On Apr 14, 4:47 am, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
<snip?
>Posting incorrect syntax won't help the OP. In fact, there is some
evidence that the OP knows the correct syntax for what they are doing
since the problem they report is a run time one. Only an example of
their actual code will help diagnose what they are doing wrong.

Perhaps you can tell what exactly was wrong?
Nothing is wrong with the syntax (I posted further explanation else
elsethread). I did not look at the code properly. If I *had*
properly studied what Bill posted I might have phrased it like this:

| Posting obscure syntax won't help the OP. In fact, there is some
| evidence that the OP knows the correct syntax for what they are doing
| since the problem they report is a run time one. Only an example of
| their actual code will help diagnose what they are doing wrong.

with a note that the "adjusted" form of function parameter is not
common enough to be posted in a "you do it like usenet message".

My point was that the OP seemed not to be having trouble getting the
syntax since they were reporting a compile-time error. Posting an
alternative way to declare the parameter was not likely to clarify
anything for the OP. It certainly confused me, till checked the
standard.

--
Ben.
Jun 27 '08 #25

P: n/a

Ben Bacarisse <be********@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
"Bill Reid" <ho********@happyhealthy.netwrites:
<snip lots>

Why do you have to be so angry?
I'm not really angry, but I am being trolled, as is anybody
who mistakenly wanders into this group thinking it is about
technical discussions related to the "C" programming
language. If I WAS a "bleeding-heart" about "newbies"
(think of the children!) like all of the hypocritical trolls
that infect the group, I WOULD be seething. It IS totally
reprehensible how the freaks here treat people who are
just trying to learn a programming language...and this
thread is a classic example...
There is a technical matter here so I
will get stuck in, but I am wary of getting caught in the middle of a
flame war.
Don't worry about that; remember that trolls like "Little Dick"
use a "hit-and-run" strategy of posting lies and then running
away to marvel at the chaos they've caused...but in the final
analysis, they're more pathetic than dangerous, EXCEPT
to the "newbies" (THINK OF THE CHILDREN!!!); they
can't really hurt an intelligent person, who should just ignore
them in the first place.
... that's his conception about how function
pointers work, and basically mine...so here's my REALLY
compact version of the code THAT COMPILES COMPLETELY
CLEANLY FOR ME:

library_h.h

extern void my_library_function (int (*)(const char*));

library_c.c

#include "library_h.h"

void my_library_function(int my_callback_function(const char*)) {
}

You must be aware that is this not the normal syntax.
Sure it is. I use it all the time, so it's normal to me.
Usually, the
function definition is similar to the declaration, except the ';' is
replaced by the function body.
Right. Let me clue you in on something about me: I try to
conserve keystrokes where they AREN'T needed, and use
them where they help me understand my own code.
Here, you have an odd-looking
parameter.
Sorry, but does your opinion of the color of a car's paint
affect how well it runs?
Function pointer parameters usually look like this:

void my_library_function(int (*my_callback_function)(const char*)) {}
Sure. But then I have to type "(*)" (three whole extra characters!)
where I don't need to type any more characters, because the two
ways of defining the parameters ARE TOTALLY FUNCTIONALLY
IDENTICAL.
which is, of course, how you wrote it in the function's prototype.
There, I'm forced to write it that way, unless I again want to
type unwanted characters...WHICH I DON'T.
This example *seems* to declare the parameter as a function, not a
pointer to one.
The key word, as you note, is "seems", since there is no
actual difference, despite how hard one of the "troll-ettes"
here has tried to convince innocent newbies otherwise.

This is why I feel pretty confident stating that most of the
posters here are technically incompetent (or they are just
shameless trolls, take your pick): they refer to "warnings"
as "errors" and "bugs", apparently not understanding the
meanings of those words in "C" programming, as well as
function names actually being, BY COMPLETE NECESSITY,
function pointers.

Nobody can make the mistakes that "troll zero" and
his "troll-ette" has made in this thread and not be justifiably
called technically incompetent (or again, just a troll, a
person who LIES to provoke newsgroup arguments; take
your pick).
I can compile library_c.c to library_c.obj without so much as
a warning, error, scolding, and then proceed likewise to build
library.lib...so in the interest of everybody learning something
today, other than you're a tool who doesn't know how to post
to Usenet, EXPLAIN THE DISCREPANCY..."spec lawyer" it,
tell us exactly what you did differently, whatever, just clear up
the confusion here...

The answer is that there is a special dispensation:

A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type''
Great, which of course completely conforms to the basic
idea above that a function name is actually a function pointer
by the simple necessity of computer science...I'm assuming
this is "standard" language, so despite you calling it a
"special dispensation" IT IS TOTALLY CONFORMING
"STANDARD" SYNTAX.
This is the same sort of special case that makes 'int x[]' be treated
as a pointer rather than an (un-passable) array. Your example is less
than clear for people learning the language or having trouble with
function pointers. I would not post it as an example to follow, but
it is correct.
Well, I'll give you this, you a) actually admitted it is "correct";
and b) gave an innocent "newbie" a fighting chance to be
able to write correct code despite all the misinformation and
sheer idiocy put out by "troll zero" and his "troll-ette"...of course,
since what I wrote was "correct" in the first place, it would
have been best had they just pointed out the "equivalency"
of function names and function pointers and showed the
simple "equivalent" function definition rather than all the juvenile
confusing trolling...

But I WARNED the "newbie" UP-FRONT that any "correct"
answer here would be trolled, so as usual, I'm "correct" about
EVERYTHING, but people even more so than programming...

---
William Ernest Reid

Jun 27 '08 #26

P: n/a
"Bill Reid" <ho********@happyhealthy.netwrites:
Ben Bacarisse <be********@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
>"Bill Reid" <ho********@happyhealthy.netwrites:
<snip lots>
<snip>
extern void my_library_function (int (*)(const char*));

library_c.c

#include "library_h.h"

void my_library_function(int my_callback_function(const char*)) {
}

You must be aware that is this not the normal syntax.

Sure it is. I use it all the time, so it's normal to me.
That's fine, but I would not suggest it as a "first example" or in
"how to" code just because it needs more explanation.
>Usually, the
function definition is similar to the declaration, except the ';' is
replaced by the function body.

Right. Let me clue you in on something about me: I try to
conserve keystrokes where they AREN'T needed, and use
them where they help me understand my own code.
Again, that is up to you, but in my editor copying the prototype is
fewer keystrokes than writing the two forms you used.

<snip>
>Function pointer parameters usually look like this:

void my_library_function(int (*my_callback_function)(const char*)) {}

Sure. But then I have to type "(*)" (three whole extra characters!)
where I don't need to type any more characters, because the two
ways of defining the parameters ARE TOTALLY FUNCTIONALLY
IDENTICAL.
>which is, of course, how you wrote it in the function's prototype.

There, I'm forced to write it that way, unless I again want to
type unwanted characters...WHICH I DON'T.
This I don't get. You can save two keystrokes if you use the same
style in the prototype (but let me guess: a parameter name in a
prototype is "unwanted characters").

<snip>
>The answer is that there is a special dispensation:

A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type''

Great, which of course completely conforms to the basic
idea above that a function name is actually a function pointer
by the simple necessity of computer science...I'm assuming
this is "standard" language, so despite you calling it a
"special dispensation" IT IS TOTALLY CONFORMING
"STANDARD" SYNTAX.
Yes, but that does not make it good syntax. With your example, a
beginner would wonder why a variable declared to store this callback
pointer looked so different to the parameter that receives it. C has
enough special cases already.

I don't want to have a style war about how you write your programs,
but in "how to" postings I would suggest being consistent and avoiding
special cases. At least some of the "fuzz" here may have come from
your use of two different styles.

--
Ben.
Jun 27 '08 #27

P: n/a

Ben Bacarisse <be********@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
"Bill Reid" <ho********@happyhealthy.netwrites:
Ben Bacarisse <be********@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
"Bill Reid" <ho********@happyhealthy.netwrites:
<snip lots>
<snip>
extern void my_library_function (int (*)(const char*));

library_c.c

#include "library_h.h"

void my_library_function(int my_callback_function(const char*)) {
}

You must be aware that is this not the normal syntax.
Sure it is. I use it all the time, so it's normal to me.

That's fine, but I would not suggest it as a "first example" or in
"how to" code just because it needs more explanation.
OK, that's sort of fair; as I've said, I'm all about helping
the "newbies" (won't SOMEBODY think of the children!??!!!)..
Usually, the
function definition is similar to the declaration, except the ';' is
replaced by the function body.
Right. Let me clue you in on something about me: I try to
conserve keystrokes where they AREN'T needed, and use
them where they help me understand my own code.

Again, that is up to you, but in my editor copying the prototype is
fewer keystrokes than writing the two forms you used.
Uh-oh, I knew it would come to this...time and motion on
key-presses...now I'm in REAL trouble...preparing to back-pedal...
<snip>
Function pointer parameters usually look like this:

void my_library_function(int (*my_callback_function)(const char*)) {}
Sure. But then I have to type "(*)" (three whole extra characters!)
where I don't need to type any more characters, because the two
ways of defining the parameters ARE TOTALLY FUNCTIONALLY
IDENTICAL.
which is, of course, how you wrote it in the function's prototype.
There, I'm forced to write it that way, unless I again want to
type unwanted characters...WHICH I DON'T.

This I don't get. You can save two keystrokes if you use the same
style in the prototype (but let me guess: a parameter name in a
prototype is "unwanted characters").
Well, yeah...also, as you might guess, we ALL have our
little peccadillos, and I HATE parameter names in prototypes,
and I'm sure I could find a compiler or LINT someplace that
would issue a warning agreeing with my childhood toilet-training
trauma, the same way the "troll-ette" found HIS compiler
that unearthed MY "error"...
<snip>
The answer is that there is a special dispensation:

A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type''
Great, which of course completely conforms to the basic
idea above that a function name is actually a function pointer
by the simple necessity of computer science...I'm assuming
this is "standard" language, so despite you calling it a
"special dispensation" IT IS TOTALLY CONFORMING
"STANDARD" SYNTAX.

Yes, but that does not make it good syntax. With your example, a
beginner would wonder why a variable declared to store this callback
pointer looked so different to the parameter that receives it. C has
enough special cases already.
Again, I don't even consider, or was aware, it a "special case", but
rather just another manifestation of the general case regarding function
pointers...

I'm sure the OP has run away in terror by now, but PART of his
problem seemed to be not understanding that basic concept...and
there was no post except mine that demonstrated it (actually, if
you read his post, he was REALLY confused about the whole
concept of "callbacks", and NOBODY posted anything coherent
to clear ANY of that confusion EXCEPT me)...
I don't want to have a style war about how you write your programs,
but in "how to" postings I would suggest being consistent and avoiding
special cases. At least some of the "fuzz" here may have come from
your use of two different styles.
Nah, the real problem is that it's always easier to be a critic than
an artist...like I say, programming I'm not that good at, it's PEOPLE
that I really know "inside-out"...

---
William Ernest Reid

Jun 27 '08 #28

P: n/a
"Bill Reid" <ho********@happyhealthy.netwrites:
Ben Bacarisse <be********@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
<snip>
>"Bill Reid" <ho********@happyhealthy.netwrites:
Great, which of course completely conforms to the basic
idea above that a function name is actually a function pointer
by the simple necessity of computer science...I'm assuming
this is "standard" language, so despite you calling it a
"special dispensation" IT IS TOTALLY CONFORMING
"STANDARD" SYNTAX.

Yes, but that does not make it good syntax. With your example, a
beginner would wonder why a variable declared to store this callback
pointer looked so different to the parameter that receives it. C has
enough special cases already.

Again, I don't even consider, or was aware, it a "special case", but
rather just another manifestation of the general case regarding function
pointers...
It certainly is a special case. If I have a parameter that is
declared 'double **param' I can save it in a variable declared 'double
**var'. Even if it is of type 'void (*param)(char *)' I can save it
in local variable declared 'void (*var)(char *)'. But a parameter
declared 'void param(char *)' needs... You get the picture.

--
Ben.
Jun 27 '08 #29

P: n/a
On Apr 14, 7:07 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
"Bill Reid" <hormelf...@happyhealthy.netwrites:
Ben Bacarisse <ben.use...@bsb.me.ukwrote in message
news:87************@bsb.me.uk...
"Bill Reid" <hormelf...@happyhealthy.netwrites:
<snip lots>

<snip>
extern void my_library_function (int (*)(const char*));
library_c.c
#include "library_h.h"
void my_library_function(int my_callback_function(const char*)) {
}
You must be aware that is this not the normal syntax.
Sure it is. I use it all the time, so it's normal to me.

That's fine, but I would not suggest it as a "first example" or in
"how to" code just because it needs more explanation.
Usually, the
function definition is similar to the declaration, except the ';' is
replaced by the function body.
Right. Let me clue you in on something about me: I try to
conserve keystrokes where they AREN'T needed, and use
them where they help me understand my own code.

Again, that is up to you, but in my editor copying the prototype is
fewer keystrokes than writing the two forms you used.

<snip>
Function pointer parameters usually look like this:
void my_library_function(int (*my_callback_function)(const char*)) {}
Sure. But then I have to type "(*)" (three whole extra characters!)
where I don't need to type any more characters, because the two
ways of defining the parameters ARE TOTALLY FUNCTIONALLY
IDENTICAL.
which is, of course, how you wrote it in the function's prototype.
There, I'm forced to write it that way, unless I again want to
type unwanted characters...WHICH I DON'T.

This I don't get. You can save two keystrokes if you use the same
style in the prototype (but let me guess: a parameter name in a
prototype is "unwanted characters").

<snip>
The answer is that there is a special dispensation:
A declaration of a parameter as ''function returning type'' shall be
adjusted to ''pointer to function returning type''
Great, which of course completely conforms to the basic
idea above that a function name is actually a function pointer
by the simple necessity of computer science...I'm assuming
this is "standard" language, so despite you calling it a
"special dispensation" IT IS TOTALLY CONFORMING
"STANDARD" SYNTAX.

Yes, but that does not make it good syntax. With your example, a
beginner would wonder why a variable declared to store this callback
pointer looked so different to the parameter that receives it. C has
enough special cases already.

I don't want to have a style war about how you write your programs,
but in "how to" postings I would suggest being consistent and avoiding
special cases.
And the posters who declare "syntax error stupid", should
at least see if their compiler agrees.
At least some of the "fuzz" here may have come from
your use of two different styles.
My hypothesis is: Bill didn't write that stuff intentionally.
He meant to write a pointer or whatever, doesn't matter what.
But he happened to write *correct* code, and then was told
three times (two in great details about how dumb he is
making that mistake and not seeing and admitting it) he has
a syntax error there. What's the real cause of the "fuzz"
again?

A troll? Don't feed the troll, how about that! BS, in other
words.

Yevgen
Jun 27 '08 #30

P: n/a
ym******@gmail.com said:

<snip>
Now, there wasn't a syntax error.
Wrong.
So, what's the bug?
A syntax error.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #31

P: n/a
ym******@gmail.com said:
Now, there wasn't a syntax error. So, what's the bug?
Please disregard my previous reply. Mr Reid was correct. I suspect this was
accidental, but nevertheless he was right and I was wrong.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #32

P: n/a

<ym******@gmail.comwrote in message
news:50**********************************@m73g2000 hsh.googlegroups.com...
>
My hypothesis is: Bill didn't write that stuff intentionally.
He meant to write a pointer or whatever, doesn't matter what.
But he happened to write *correct* code,
Yeah, correct code happens "by accident", riiiiiiiiight...I almost
forgot I'm in the group that is so statistically incompetent that it
believes you can win a casino gambling game by doubling your
bet on every loss...
and then was told
three times (two in great details about how dumb he is
making that mistake and not seeing and admitting it) he has
a syntax error there.
But there was NO "syntax error", you know that!!! What the hell is
the matter with you, afraid of the big bad trolls?!??! THEY'RE STUPID
PUNKS, PERIOD, THE ONLY CREDIBILITY THEY HAVE IS WHAT
YOU GIVE THEM BECAUSE YOU'RE AN EVEN STUPIDER
PUNK THAN THEY ARE.
A troll? Don't feed the troll, how about that!
Exactly! So why do you keep feeding "Little Dick" and
"troll-ettes"? Ignore them, or mock them, whatever, the
thing about trolls is they never CAN change their defective
behavior, so just have a little fun by laughing at their
pathetic lives or pass 'em by and have some more
productive fun somewhere else, it's all the same, but
NEVER LET THEM CONTROL YOU...

You KNOW they are LYING about "errors" and "bugs"; otherwise
they are just technically incompetent, take your pick, maybe mix
and match. A troll is somebody who DELIBERATELY lies to provoke
a newsgroup into an unproductive flame-war, and generally ducks
out early to sit back and watch the "fun".

Who're the LIARS here, and who LIED AND RAN?!??!

Don't feed the trolls indeed; actually, I'm sorry I answered THIS
completely DUMBASS post...

---
William Ernest Reid

Jun 27 '08 #33

P: n/a
Nick Keighley<nick_keighley_nos...@hotmail.comwrote in message
news:ef**********************************@m73g2000 hsh.googlegroups.com...
On 14 Apr, 10:34, ymunt...@gmail.com wrote:
On Apr 14, 3:49 am,Nick Keighley<nick_keighley_nos...@hotmail.com>
wrote:
On 14 Apr, 03:24, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Angus <nos...@gmail.comwrote in message
news:ft*******************@news.demon.co.uk...
On 14 Apr, 15:50, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Wouldn't you know it, this tool posts from Google(TM) Groups...
"tool"? Is this sort of language necessary?

HEY, FOOL, IF YOU'RE GONNA BE SUCH AN IDIOT AS TO
POST FROM THE SCOURGE OF USENET, AT LEAST LEARN
HOW TO DO IT SO YOUR POSTS ARE QUOTED PROPERLY!!!
I'm genusinely curious. In what way have I misquoted? I've
been quoting in usenet in this manner for some time and
assumed it was a well known quoting convention.
And one that *most* people use.

All upper case is often regarded as rude. But then I suspect
you know that. :-)

TIA!!! *(but really, not holding my breath waiting for him to learn
how to post to Usenet...that's too "technical")
So explain.

<attributions moved to top of post>

<snip>
In the header file for your library, declare the function as follows:
extern void my_library_function(int (*)(const char*));
(Note: as somebody may tell you, "extern" is a redundant
linkage specifier for function declarations, but I use it anyway
and therefore you should too!)
a substantial body of people don't, so consider missing it out.

Maybe it's a mistake to NOT include it...I know this is hard,
but THINK...
Nope sorry. You use the convention. I don't. I have been using my
convention for quite some time and I'm quite happy with it.
Merely admonishing me to think won't help. I've thought.

So do you have a good reason to include the extern?
I thought you liked to save typeing!

Have you ever heard of a guy named Eric Naggum?

<snip>
sometimes you have to really "think"
about what the perfect "signature" will be for all the various
callbacks you want for a generic library function, what all
data you need to pass for all possible conditions...
no not at all.

OK, you're right, you don't have to THINK about anything at all
when programming...oh, that's right, you DO have to think when
programming, just not when posting to the Internet...
Ah, you seem to have misunderstood. I meant I've never found
getting the signature right for callbacks was particularly
difficult, not that thinking whilst programming was unnecessary.

It's hard to understand how you could have made this mistake.

<snip>
extern void my_library_function (int (*)(const char*));
void my_library_function(int my_callback_function(const char*)) /*
<--- error */
<snip>
and my compiler does this
Compiling...
reid.c
C:\bin\reid.c(6) : warning C4028: formal parameter 1 different from
declaration
Is it the error you mentioned?

--- unquoted tool text ---
is *what* the error I mentioned? The error above occurs on
the line I indicated.
--- end tool text
You seem to be using a very unusual quoting convention.
Is there an RFC for it?

He's asking you why your compiler reports an error, since his
may not under the same circumstances, you massive tool...
I didn't know his compiler didn't produce a diagnostic.

<snip>
here's my REALLY
compact version of the code THAT COMPILES COMPLETELY
CLEANLY FOR ME:
ah, I wasn't aware that some compilers didn't issue a diagnostic.
Which compiler is it and do you have warnings set to their
highest level? This is a good practice.

<snip>

This is a technical news group there really isn't any
point in getting so wound up. Perhaps less coffee in future?
--
Nick Keighley

"You are not thinking...you are merely being logical". Niels Bohr
Jun 27 '08 #34

P: n/a
Hi Bill,

It appears I was mistaken (ie. wrong) in thinking your code
had a syntax error. I apologise.

In future I should check the standard and not trust my (aged)
compiler.

On a style note I prefer the use of a typedef (it even saves
typeing).

typedef int (*Callback_func) (const char*);

int callback_user (Callback_func callback)
{
int retval;
retval = callback ("pippo");
return retval;
}

--
Nick Keighley
Jun 27 '08 #35

P: n/a
Nick Keighley said:
Hi Bill,

It appears I was mistaken (ie. wrong)
So was I (cf <2I******************************@bt.com>)

<snip>
On a style note I prefer the use of a typedef (it even saves
typeing).

typedef int (*Callback_func) (const char*);
I prefer not to hide the pointeriness in the type:

typedef int Callback_func(const char *);

but rather to make it explicit in the prototype:

int callback_user (Callback_func* callback)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #36

P: n/a
On 15 Apr, 10:32, Richard Heathfield <r...@see.sig.invalidwrote:
Nick Keighley said:
<snip>
On a style note I prefer the use of a typedef (it even saves
typeing).
typedef int (*Callback_func) (const char*);

I prefer not to hide the pointeriness in the type:

typedef int Callback_func(const char *);

but rather to make it explicit in the prototype:

int callback_user (Callback_func* callback)
That's why I use the *_func convention.
But this is sailing close to hungarian.
And I dislike other examples of hidden pointers.
So I may change to your convention.
--
Nick Keighley

"Programs must be written for people to read, and only
incidentally for machines to execute."
- Abelson & Sussman, Structure and Interpretation of Computer Programs
Jun 27 '08 #37

P: n/a
ym******@gmail.com writes:
On Apr 14, 7:07 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
<snip>
>At least some of the "fuzz" here may have come from
your use of two different styles.

My hypothesis is: Bill didn't write that stuff intentionally.
He meant to write a pointer or whatever, doesn't matter what.
But he happened to write *correct* code,
That seems a little unfair. He says that he prefers the syntax in
definitions because it saves '(*)' and he uses '(*)' in prototypes
because it is shorter and avoids a (technically) redundant name and I
don't see any reason not to believe that.
and then was told
three times (two in great details about how dumb he is
making that mistake and not seeing and admitting it) he has
a syntax error there. What's the real cause of the "fuzz"
again?

A troll? Don't feed the troll, how about that! BS, in other
words.
I don't understand this. Bill Reid has an angry, aggressive style
that means I often skip his posts, but I never called him a troll.

--
Ben.
Jun 27 '08 #38

P: n/a
Richard Heathfield <rj*@see.sig.invalidwrites:
Nick Keighley said:
>Hi Bill,

It appears I was mistaken (ie. wrong)

So was I (cf <2I******************************@bt.com>)

<snip>
>On a style note I prefer the use of a typedef (it even saves
typeing).

typedef int (*Callback_func) (const char*);

I prefer not to hide the pointeriness in the type:

typedef int Callback_func(const char *);

but rather to make it explicit in the prototype:

int callback_user (Callback_func* callback)
Agreed 100%. Easy "at a glance" signalling of pointer usage.
Jun 27 '08 #39

P: n/a

Look, I am not going to manually quote your messed-up post
from googlegroups.com (I actually just don't bother to respond
to these types of posts because they rarely have anything
intelligent in them in the first place in addition to the quoting
problem), but I'll make a few points:

1. Don't ask me how to use Google(TM) Groups to get
posts that are quoted properly when I try to respond to them,
because I don't use that piece of crap server, I have an
actual non-library computer of my own, and a real ISP
account with a real news server and use a real, if not
particularly good, newsreader. All I know is that SOME
posts from googlegroups.com are not quoted properly
when I try to respond to them, BUT OTHERS ARE,
so it's something YOU are doing differently from other
idiots who use googlegroups.com...and yes, I generally
just assume everybody who posts from googlegroups.com
is an idiot, just like the old method of looking for "webtv"
or "aol" as the posting host...and furthermore, googlegroups.com
is single-handedly destroying Usenet and must be stopped
(well, maybe not MUST, because actually who cares)...more
on this at the end of this post...

2. extern = EXPLICIT, I know what I'm TRYING to do

3. If you haven't had to think carefully about exactly what
data you want to pass to a callback, you are very inexperienced
using callbacks, sorry...your toy program writing background
is showing again...

4. Hey, what compiler are YOU using? I have three warning
levels on mine: None, Selected (whatever that means), and
All (I usually use the default, "Selected"). None of them produce
a warning for that code, and if it did, I'd consider getting a new
compiler, because I have no use for a warning about something
that could NEVER EVER POSSIBLY BE A PROBLEM. Just
about all of the warnings I do get are useful, because they do
properly warn me that I MAY be doing something dangerous,
but that is not the case here...and I'll bet there aren't a lot
of compilers out there that are so brain-dead they can't
recognize perfectly legal STANDARD equivalent declarations
properly, I'm not even sure you just didn't FAKE your so-called
"error"...

5. As a technical newsgroup I expect technically accurate
responses, or short PRODUCTIVE RESPECTFUL discussions
to resolve any "discrepancies"...unfortunately, that's not the
"posting style" of a lot of the frequent posters here.

6. I'm not swiching to decaf.

7. DIE GOOGLE(TM) DIE!!!

I'm going to re-print a post I made in another group the other day;
this is my vainglorious attempt (probably in vain) to "save Usenet";
"aol" is largely just a bad memory, "webtv" is still around a little
bit as the official posting host of toofless hillbillies, now it's time
to take out the trash of Google(TM), let's try at least:

From: "Bill Reid" <ho********@happyhealthy.net>
Newsgroups: misc.invest.stocks
Subject: Re: Would there be any support for a moderated group???
Date: Sun, 13 Apr

Blash <bl****@comcast.netwrote in message
news:C4*******************@comcast.net...
This used to be a fun groupSSthere was a lot of info exchanged by
participants ranging from the well-informed to the terminally
cluelessSSthere was give-and-take, humor, arguments, theories, etc.
Whats dominating the N/G now??? Ads for Chinese ripoffs, pure
bigotry,
forex cant-lose systems, cross-postings from political whackos, psychotic
venting & threats, kiddies with $6 get-rich schemes, etc.SS.
I dont know whatOs involved in a moderated group or if they even
workSSIs there anyone here that can shed some informed light on the
subject???
Forget it "Blash", it's UsenetTown...

Having gone through this exact thing with other newsgroups that
USED to be focal points of ON-TOPIC conversation about a specific
subject, I know for a fact that a moderated group will probably
NOT work, because it didn't for the other groups. They went through
the whole voting process, got the server, moderator(s), within a
year the moderated group was dead as well and the original
group was just a wasteland of spam...

Remember, I've repeatedly set out the timeline for the ultimate
demise of this group, and we're right on schedule. It's not JUST
the spammers; the death knell is the arrival of completely demented
fakes that sock-puppet each other and form a "voting block" to drive
away any intelligent posters with constant insane repugnant behavior
(sound familiar?). THAT'S the "gating factor" that can predict to a
matter of months the death of the group...again, I speak from
previous experience, you REALLY don't want to know the gory
details...

In a larger sense, Usenet itself is just a manifestation of the
old theory of "The Tragedy Of The Commons" (the idea that
"communism" can NEVER "work"), that a shared resource
that should be used responsibly by all people WILL ultimately
be destroyed by the lowest common denominator.

It also follows my general management principle, which SHOULD
be the foundation for all businesses and "capitalism" as a
whole, that when you divorce RESPONSIBILITY from AUTHORITY
you get chaos, not anything remotely resembling the "invisible
hands" that apologists for "capitalism" like to yammer about.
ANYBODY has the "authority" to post here, whether "homeless",
briefly un-incarcerated mentally-ill, ex-con, Chinese shoe spammer,
whatever, but accept NO "responsibility" to behave in a respectful
productive manner.

BUT...here's a slightly different idea, from a long time ago (in
Internet years). There used to be a concept called the "Usenet
Death Penalty", where a Usenet server that was providing a free
reign to spammers and/or loonies would be "removed" from
Usenet by mutual agreement of the major server operators.
They would just stop picking up posts from the outlaw server,
and that would effectively stop the problem in its tracks;
NOBODY who didn't use that server would ever see posts
from that server again...PROBLEM SOLVED!!! But I'm not
sure what the current status of that "system" is...

But we all know where 95% of today's problems originate, it's
called "Google(TM) Groups". Check the "Path" of a Chinese shoe
spammer or insane mongoloid, and it almost certainly will end
like this (signifying that is the original server that the creep posted
to):

Path:
<your_server>!<server_your_server_copied_post_from !server_that_server_copied
_post_from!and_so_forth!...!...!postnews.google.co m!e67g2000hsa.googlegroups
..com!not-for-mail

(the above is an edited header from a "BuffyTheProfitHater" post)

Unfortunately, my newsreader, and many other newsreaders, do
not support "killfiling" a post by the original server, but this is
definitely
something that can be done at the "client" level, so if you have this
capability and are bothered by Chinese spammers and loonies
just "killfile" "googlegroups.com" and you're sailing clear seas
again...

OK, failing that, here's another idea: KILL Google(TM). No,
not "killfile" "googlegroups.com", not the "Usenet Death Penalty"
for "googlegroups.com", I MEAN KILL THE FRIGGIN' COMPANY
GOOGLE...DEAD!!!

Google(TM) STILL derives MOST of its revenue from those little
links they identify as "sponsored links" in your search results.
IF YOU DON'T CLICK ON THOSE LINKS, GOOGLE(TM) GOES
OUT OF BUSINESS (until they wise up and hide the "sponsored
links" in the sea of search results, which they've already started
doing a little bit as their "paid click rates" have gone down
recently).

You DON'T have to click on those links; I've almost never clicked
on them, and I use Google(TM) search all the time, and use it to
book hotels, airline tickets, etc., BUT I CLICK ON AN IDENTICAL
UN-SPONSORED LINK RIGHT BELOW THE SPONSORED
LINK...THEY'RE THE SAME DAMN LINK, BUT GOOGLE(TM)
DOESN'T GET ANY MONEY FOR IT (or shouldn't)!!!

So here's what you do; send a complaint e-mail about whatever
it is in this group that you don't want to see that is coming from
"googlegroups.com" to this address:

Complaints-To: gr**********@google.com

Word is that they COMPLETELY ignore all mail sent to that
address (the same way Netscape used to ignore all bug-mail,
remember them?), but in addition to specifying the specific
types of posts that are ruining Usenet for you, make sure you
let them know that until THEY take RESPONSIBILITY for
the spam and threats and slander, you will do what you can
to PUT THE ENTIRE DAMN COMPANY OUT OF BUSINESS.

They almost certainly will STILL ignore it, but I always like
watching companies die anyway ("creative destruction") so
what the hell, let's kill 'em dead and make room for the next
flash-in-the-pan Internet company...and if they actually do
something, it will be fun to watch "Lowbrow" scramble for
another free way to entertain us with his idiocy...

---
William Ernest Reid
Post count: 1022

---end of archived post

---
William Ernest Reid

Jun 27 '08 #40

P: n/a
"Bill Reid" <ho********@happyhealthy.netwrites:
4. Hey, what compiler are YOU using? I have three warning
levels on mine: None, Selected (whatever that means), and
All (I usually use the default, "Selected"). None of them produce
a warning for that code, and if it did, I'd consider getting a new
compiler, because I have no use for a warning about something
that could NEVER EVER POSSIBLY BE A PROBLEM. Just
about all of the warnings I do get are useful, because they do
properly warn me that I MAY be doing something dangerous,
but that is not the case here...and I'll bet there aren't a lot
of compilers out there that are so brain-dead they can't
recognize perfectly legal STANDARD equivalent declarations
properly, I'm not even sure you just didn't FAKE your so-called
"error"...

Possibly Nick should consider trying things out rather than relying on
the new vogue in c.l.c which is "power analysis" of 10 foot high
printouts. Me? I regularly check code with "splint" as well as use
pedantic modes in gcc. Here's a little bit of "splint" integration for
emacs that I knocked up recently ....

,----
| (defun do-lint()
| (interactive)
| (set (make-local-variable 'compile-command)
| (let ((file (file-name-nondirectory buffer-file-name)))
| (format "%s %s %s"
| "splint"
| "+single-include -standard -preproc -I/usr/include/gtk-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/cairo/ -I/usr/include/pangomm-1.4/pangomm/"
| file
| )))
| (message compile-command)
| (compile compile-command)
| )
|
`----

Sure, not ISO Standard C, but gives some hints to fellow programmers
about how best to proceed before huffing and puffing in this NG like a
member of the Reform Club who has just discovered that they have changed the
Port supplier in addition to allowing "foreigners" in ....

Jun 27 '08 #41

This discussion thread is closed

Replies have been disabled for this discussion.