Given the following code:
#pragma once
class B
{
public:
B(void)
{
}
~B(void)
{
}
};
I know I can also write this:>
A long time ago you did something like this in C (my pre-ISO C is rusty :) ):
void foo(a, b)
int a,
int b
{
}
while C++ was being created the name mangling required the types of the arguments, so for C++ it was changed to:
void foo(int a, int b)
{
}
and this change was brought forward to C.
At this point, I believe to avoid breaking existing C code this:
void foo()
and this:
void foo(void)
meant two very different things, ()
means do not check for the argument number or type, and (void)
means takes no arguments. For C++ ()
meaning not to check anything was not going to work so ()
and (void)
mean the same thing in C++.
So, for C++ ()
and (void)
were always the same thing.
At least that is how I remember it... :-)