J
jeffc
WW said:Stop trolling please.
And your constant quarreling, and hypocritical remark above, are what?
WW said:Stop trolling please.
I understand the distinction and the history, but I still fail to
understand why (void) is frowned upon or viewed as "C".
I happen to like the explicit way in which it says "this function
takes no arguments".
tom_usenet said:Jonathan Mcdougall said:I have a class member function declared as
class some_class {
...
virtual int call(void);
void in an empty parameter list is considered bad style in C++.
[...]
Since when?
Dennis Ritchie and Doug Ilroy described use of void to represent an
empty parameter list in C as an "abomination". Stroustrup agrees with
them, and void f(void); was illegal syntax in the early days of C++.
However it was reincorporated into C++ when C89 decided to use that
syntax in the interests of compatibility.
Vladimir said:Hello,
I have a class member function declared as
class some_class {
...
virtual int call(void);
};
Can I use this-> inside the function body?
David said:I understand the distinction and the history, but I still fail to
understand why (void) is frowned upon or viewed as "C".
I happen to like the explicit way in which it says "this function
takes no arguments".
Jonathan Mcdougall said:[...]
int f();
could not be more explicit.
What's more, I think (void) is not only bad style, but
deprecated.
But I could be wrong.
Kevin Goodsell said:Well, I don't mean to be argumentative,
but it seems to me that showing the function with no
arguments is possibly a *more* explicit (or at least logical)
way of showing that it takes no arguments than showing it
with what appears to be a void argument. Granted, no C++
programmer will actually be lead to believe that the function
takes one argument of type void, but that is what the syntax
suggests. This is why I agree that the syntax is an
"abomination", as was stated elsewhere.
[...]
David said:WW said:Stop trolling please.
[Earlier, you said...]And as everything redundant adding no value, the only
thing it can add is error, misunderstanding, misleading,
wondering collegagues why is it there and so forth.
Can you spell "FUD"? Physician, heal thyself.
jeffc said:And your constant quarreling, and hypocritical remark above, are what?
Attila said:David said:jeffc wrote:
So why do you have to pick a quarrel on everything?
bwahahahaahahaha
Stop trolling please.
[Earlier, you said...]
And as everything redundant adding no value, the only
thing it can add is error, misunderstanding, misleading,
wondering collegagues why is it there and so forth.
Can you spell "FUD"? Physician, heal thyself.
Stop trolling please.
Noah said:So why do you have to pick a quarrel on everything?
bwahahahaahahaha
Stop trolling please.
[Earlier, you said...]
And as everything redundant adding no value, the only
thing it can add is error, misunderstanding, misleading,
wondering collegagues why is it there and so forth.
Can you spell "FUD"? Physician, heal thyself.
Stop trolling please.
He's like a broken record
David said:Jonathan Mcdougall said:[...]
int f();
could not be more explicit.
Sure it could. Add "void".
Then you aren't wondering if you
are looking at a C++ function that takes no arguments, or a
C function that takes an unknown number of arguments.
Because we all know that if you don't do that, Russia will
invade, we will be attacked by aliens, and global warming
will cause the earth to burn up. That's what will happen if you
don't use "void".
David said:Well, void doesn't quite work with metaprogramming, but it
should. I mean, how handy would it be if we could substitute
any number of void arguments in a template function? We
wouldn't need to write a hundred overloads! Like this:
int foo(void, void); // takes no arguments
Why would you want to do that? Why, so you could do this,
of course:
template <typename T1 = void, typename T2 = void, ...>
int foo(T1 t1, T2 t2, ...);
And voila! You just wrote N overloads that currently require
tedious cut-n-paste or preprocessor magic.
Anyway, I think of "void" as a "metanull". It's a metavalue
which indicates nothingness, like NULL, kinda. Would you
say that this is more "explicit"?
int* p = ;
Rolf said:The question is where could you practically use it? I mean, you can't
use the parameters within your function, because they might not exist.
So what are they useful for then?
Well, you also don't write:
void x;
to state that x is not a variable.
Sure it could. Add "void".
Then you aren't wondering if you
are looking at a C++ function that takes no arguments, or a
C function that takes an unknown number of arguments.
LOL!!! As if (void) is so evil that we must get rid of it at all
costs!
I certainly hope so. There's much worse things to worry about
than (void).
David said:To each his own. When I see (int) 3.14, I think "C". But that's
because there's a *better* way to do it in C++. When I see
"(void)", I *don't* think "C", because the "C++ Way" isn't
technically better. It's just different.
WW said:If we say "you are right" will you stop ranting?
Rolf Magnus said:[...]
The question is where could you practically use it? I mean,
you can't use the parameters within your function, because
they might not exist. So what are they useful for then?
[...]
void x;
to state that x is not a variable.
Attila Feher said:[...][...]
And as everything redundant adding no value, the only
thing it can add is error, misunderstanding, misleading,
wondering collegagues why is it there and so forth.
Yes, he is. I wish he would stop trolling.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.