Yes. I meant to pass a function pointer to the "delegate" variable.
By the way, is
int ( * delegate ) ( int x, ... );
still a variable? I would say it is, since pointers are only variables
that can hold memory a address.
It declares a variable named "delegate" of type "pointer to function
taking an integer and a variadic argument list and returning an int".
In other words, I think the answer to your question is "yes", more or
less. You're correct that pointers, including function pointers, are
variables.
But that's not an error. It defines a variable that can hold a memory
address to a char and a variable that holds a char.
Ah, but it is an error. Source code has two audiences: programmers
and language implementations. It must speak accurately to both.
Even if this fragment contains no C errors, it still contains an
error in its representation of the program to programmers, because
the name of the "pointer2" variable belies its type.
I don't exactly know the
C-Coding Guidelines,
There are guidelines and guidelines; none have any force other than
opinion, but some of them are better-informed and justified opinions
than others. Agreement is fairly widespread on this particular
point (not separating the "*" and the identifier name when declaring
pointers).
To the main problem: i wanted to return to C-Style for developing a
some server-core-components. Coming from Perl/Java, i want to test the
boundaries of the C-Language-functionalities.
I have to (re)reorient a bit, when returning to C.
So, in a procedural language like c i have to achieve that kind of
functionality by passing args to the function.
That's correct. Typically OO languages "invisibly" pass a reference
to the calling object to the method it invokes. In C you have to do
that explicitly, because the language doesn't do it for you. Simple
as that.
If you'd prefer a language with built-in OO support, there's always
C++, of course. Just like C except for a handful of subtle differences
and several tons of baggage piled on top. Combines C's safety and
ease of use with Perl's clarity and maintainability.
--
Michael Wojcik (e-mail address removed)
There are many definitions of what art is, but what I am convinced art is not
is self-expression. If I have an experience, it is not important because it
is mine. It is important because it's worth writing about for other people,
worth sharing with other people. That is what gives it validity. (Auden)